using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace FrontendWebApi.Models
{
    public enum OperationRecordStatusEnum : byte
    {
        NoneComplete = 0, //未完成
        Complete = 1, //完成
        NoneCompleteExpired = 2, //未完成-過期
        CompleteExpired = 3, //完成-過期
    }

    public enum OperationRecordWorkTypeEnum : byte
    {
        Clearn = 0, //清潔
        Inspection = 1, //巡檢
        Fix = 2, //維修
    }

    public class Operation_Firm : Actor
    {
        public int id { get; set; }
        public byte deleted { get; set; }
        public string device_system_category_layer2 { get; set; }//系統類別(第2層)
        public string device_system_category_layer3 { get; set; }//系統類別(第3層)
        public string name { get; set; }//名称
        public string contact_person { get; set; }//联络人
        public string phone { get; set; }//电话
        public string email { get; set; }//Email
        public string tax_id_number { get; set; }//统一编号
        public string remark { get; set; }//备注
        public string system_key { get; set; }//類別名稱
    }

    public class OperationFindList
    {
        public int id { get; set; }
        public string serial_number { get; set; } //表单号
        public DateTime? start_created_at { get; set; }//开始建立时间
        public DateTime? end_created_at { get; set; }//结束建立时间
        //public bool today { get; set; }//今天建立时间
        //public bool yesterday { get; set; }//昨天建立时间
        public List<string> main_system_tag { get; set; }//大类tag
        public List<string> sub_system_tag { get; set; }//小类tag
        public byte? work_type { get; set; } // 1:保養, 2:維修
    }

    public class BuildingList
    {
        public string device_area_tag { get; set; }
        public string device_building_tag { get; set; }
        public string device_floor_tag { get; set; }
        public string area_name { get; set; }
        public string building_name { get; set; }
        public string main_system_tag { get; set; }//大类tag
        public string sub_system_tag { get; set; }//小类tag
        public List<string> list_sub_system_tag { get; set; }
    }

    public class Operation_Record : Actor
    {
        public int id { get; set; }
        public byte? deleted { get; set; }
        public string formId { get; set; }
        public string location { get; set; }
        public string location_code { get; set; }
        public string device_system_category_layer2 { get; set; }
        public string device_system_category_layer3 { get; set; }
        public byte work_type { get; set; }
        public string error_code { get; set; }
        public string fix_do { get; set; }
        public string fix_do_code { get; set; }
        public int fix_firm { get; set; }
        public byte status { get; set; }
        public string work_person_id { get; set; }
        public DateTime? start_time { get; set; }
        public DateTime? end_time { get; set; }
        public DateTime? work_time { get; set; }
        public DateTime? finish_time { get; set; }
        public string notice { get; set; }
        public string description { get; set; }
        public string work_type_name
        { 
            get
            {
                Dictionary<byte, string> name = new Dictionary<byte, string>()
                {
                    { 1 , "保養" },
                    { 2 , "維修" }
                };
                return name[work_type];
            }
        }
        public string status_name
        {
            get
            {
                Dictionary<byte, string> name = new Dictionary<byte, string>()
                {
                    { 0, "未完成"},
                    { 1, "完成"},
                    { 2, "未完成-過期"},
                    { 3, "完成-過期"}
                };
                return name[status];
            }
        }
        public string device_name { get; }
        public string device_area_tag { get; }
        public string device_building_tag { get; }
        public string device_floor_tag { get; }
        public string user_full_name { get; }
        public List<Operation_Record_File> lorf { get; set; }
    }

    public class Operation_Record_File : Actor
    { 
        public int id { get; set; }
        public byte deleted { get; set; }
        public int record_id { get; set; }
        public IFormFile file { get; set; }
        public string ori_file_name { get; set; }
        public string save_file_name { get; set; }
    }

    public class Find_Sub_List
    {
        public List<string> main_system_tag { get; set; }
    }

    public class ExportExcel
    {
        public byte? work_type { get; set; }
        public DateTime? startdate { get; set; }
        public DateTime? enddate { get; set; }
    }
}