using System;
using System.Collections.Generic;
using Dapper.Contrib.Extensions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Org.BouncyCastle.Bcpg.OpenPgp;

public class DbTableClass
{

    [Table("quotationView")]
    public class quotationView
    {
        [JsonIgnore]
        [Key]
        public int quotation_sn { get; set; }
        public string quotation_uid { get; set; } = "";
        public string quotation_name { get; set; } = "";
        public string quotation_date { get; set; } = "";
        public string dept_uid { get; set; } = "";
        public string quotation_expStart { get; set; } = "";
        public string quotation_expEnd { get; set; } = "";
        public string quotation_prodMethod { get; set; } = "";
        public string project_uid { get; set; } = "";
        public string modelProj_uid { get; set; } = "";
        public string modelQuotation_uid { get; set; } = "";
        public string company_uid { get; set; } = "";
        public string contactPerson_uid { get; set; } = "";
        public double quotation_noTaxTotal { get; set; } = 0.0;
        public double quotation_specTotal { get; set; } = 0.0;
        public double quotation_tax { get; set; } = 0.0;
        public double quotation_grandTotal { get; set; } = 0.0;
        public string quotation_sa { get; set; } = "";
        public string quotation_isdel { get; set; } = "";
        public string quotation_revoke { get; set; } = "";
        public int quotation_version { get; set; } = 0;
        public DateTime quotation_createdate { get; set; } = DateTime.Now;
        public DateTime quotation_modifydate { get; set; } = DateTime.Now;
        public string quotation_create_uid { get; set; } = "";
        public string quotation_modify_uid { get; set; } = "";
        public string contactPerson_name { get; set; } = "";
        public string contactPerson_email { get; set; } = "";
        public string contactPerson_tel { get; set; } = "";
        public string contactPerson_fax { get; set; } = "";
    }



    [Table("invoice")]
    public class invoice
    {
        [JsonIgnore]
        [Key]
        public int invoice_sn { get; set; }
        public string invoice_uid { get; set; } = "";
        public string quotation_uid { get; set; } = "";
        public string invoice_name { get; set; } = "";

        public string invoice_type { get; set; } = "";
        public string invoice_text { get; set; } = "";
        public int invoice_year { get; set; } = 2024;
        public int invoice_month { get; set; } = 1;
        public int invoice_noTaxMoney { get; set; } = 0;
        public string invoice_revoke { get; set; } = "N";
        public int invoice_version { get; set; } = 1;
        public DateTime invoice_createdate { get; set; } = DateTime.Now;
        public DateTime invoice_modifydate { get; set; } = DateTime.Now;
    }



    [Table("payment")]
    public class payment
    {
        [JsonIgnore]
        [Key]
        public int payment_sn { get; set; }
        public string payment_uid { get; set; } = "";
        public string quotation_uid { get; set; } = "";
        public string payment_method { get; set; } = "";
        public string payment_methodname { get; set; } = "";
        public string payment_descript { get; set; } = "";
        public string payment_revoke { get; set; } = "N";
        public int payment_version { get; set; } = 1;
        public DateTime payment_createdate { get; set; } = DateTime.Now;
        public DateTime payment_modifydate { get; set; } = DateTime.Now;
    }



    [Table("quotationSubItem")]
    public class quotationSubItem
    {
        [JsonIgnore]
        [Key]
        public int quotationSubItem_sn { get; set; }
        public string quotationSubItem_uid { get; set; } = "";
        public string quotation_uid { get; set; } = "";
        public string subItem_uid { get; set; } = "";
        public string quotationMainItem_uid { get; set; } = "";
        public string quotationSubItem_name { get; set; } = "";
        public string quotationSubItem_descript { get; set; } = "";
        public double quotationSubItem_price { get; set; } = 0.0;
        public string quotationSubItem_unitType { get; set; } = "";
        public double quotationSubItem_number { get; set; } = 0.0;
        public double quotationSubItem_subTotal { get; set; } = 0.0;
        public string quotationSubItem_hasAC { get; set; } = "Y";
        public string quotationSubItem_revoke { get; set; } = "N";
        public int quotationSubItem_version { get; set; } = 1;
        public DateTime quotationSubItem_createdate { get; set; } = DateTime.Now;
        public DateTime quotationSubItem_modifydate { get; set; } = DateTime.Now;
    }



    [Table("quotationMainItem")]
    public class quotationMainItem
    {
        [JsonIgnore]
        [Key]
        public int quotationMainItem_sn { get; set; }
        public string quotation_uid { get; set; } = "";
        public string mainItem_uid { get; set; } = "";
        public string quotationMainItem_uid { get; set; } = "";
        public string quotationMainItem_name { get; set; } = "";
        public double quotationMainItem_ac { get; set; } = 0.0;
        public double quotationMainItem_subTotal { get; set; } = 0.0;
        public string quotationMainItem_revoke { get; set; } = "N";
        public int quotationMainItem_version { get; set; } = 1;
        public DateTime quotationMainItem_createdate { get; set; } = DateTime.Now;
        public DateTime quotationMainItem_modifydate { get; set; } = DateTime.Now;
    }



    [Table("quotation")]
    public class quotation
    {
    
        [Key]
        public int quotation_sn { get; set; }
        public string quotation_uid { get; set; } = "";
        public string quotation_name { get; set; } = "";
        public string quotation_date { get; set; } = "";
        public string dept_uid { get; set; } = "";
        public string quotation_expStart { get; set; } = "";
        public string quotation_expEnd { get; set; } = "";
        public string quotation_prodMethod { get; set; } = "";
        public string project_uid { get; set; } = "";
        public string modelProj_uid { get; set; } = "";
        public string modelQuotation_uid { get; set; } = "";
        public string company_uid { get; set; } = "";
        public string contactPerson_uid { get; set; } = "";
        public double quotation_noTaxTotal { get; set; } = 0.0;
        public double quotation_specTotal { get; set; } = 0.0;
        public double quotation_tax { get; set; } = 0.0;
        public double quotation_grandTotal { get; set; } = 0.0;
        public string quotation_sa { get; set; } = "";
        public string quotation_isdel { get; set; } = "";
        public string quotation_revoke { get; set; } = "";
        public int quotation_version { get; set; } = 1;
        public string quotation_log { get; set; } = "";
        public DateTime quotation_createdate { get; set; } = DateTime.Now;
        public DateTime quotation_modifydate { get; set; } = DateTime.Now;
        public string quotation_create_uid { get; set; } = "";
        public string quotation_modify_uid { get; set; } = "";
    }



    [Table("projectView")]
    public class projectView
    {
        [JsonIgnore]
        [Key]
        public int project_sn { get; set; }
        public string dept_uid { get; set; } = "";
        public string project_ps { get; set; } = "";
        public string project_uid { get; set; } = "";
        public string project_name { get; set; } = "";
        public string project_datetime { get; set; } = "";
        public string company_uid { get; set; } = "";
        public string project_creative_uid { get; set; } = "";
        public string project_lastmodify_uid { get; set; } = "";
        public DateTime project_createdate { get; set; } = DateTime.Now;
        public DateTime project_modifydate { get; set; } = DateTime.Now;

        public string project_isdel { get; set; } = "N";
        public string company_name { get; set; } = "";
        public string company_serialNo { get; set; } = "";
        public string company_address { get; set; } = "";
        public string company_tel { get; set; } = "";
        public string company_fax { get; set; } = "";
        public string user_id { get; set; } = "";
        public string user_name { get; set; } = "";
        public string user_email { get; set; } = "";
    }

    [Table("project")]
    public class project
    {
        [JsonIgnore]
        [Key]
        public int project_sn { get; set; }
        public string dept_uid { get; set; } = "";
        public string project_uid { get; set; } = "";
        public string project_name { get; set; } = "";
        public string project_datetime { get; set; } = "";
        public string company_uid { get; set; } = "";
        public string project_ps { get; set; } = "";

        public string project_isdel { get; set; } = "N";

        public string project_creative_uid { get; set; } = "";
        public string project_lastmodify_uid { get; set; } = "";
        public DateTime project_createdate { get; set; } = DateTime.Now;
        public DateTime project_modifydate { get; set; } = DateTime.Now;
    }

    [Table("modelSubItem")]
    public class modelSubItem
    {
        [JsonIgnore]
        [Key]
        public int modelSubItem_sn { get; set; }
        public string modelSubItem_uid { get; set; } = "";
        public string modelMainItem_uid { get; set; } = "";
        public string subItem_uid { get; set; } = "";
        public string modelSubItem_name { get; set; } = "";
        public string modelSubItem_descript { get; set; } = "";
        public double modelSubItem_price { get; set; } = 0.0;
        public string modelSubItem_unitType { get; set; } = "";
        public double modelSubItem_number { get; set; } = 0.0;
        public double modelSubItem_subTotal { get; set; } = 0.0;
        public string modelSubItem_hasAC { get; set; } = "N";
        public DateTime modelSubItem_createdate { get; set; } = DateTime.Now;
        public DateTime modelSubItem_modifydate { get; set; } = DateTime.Now;
        public string modelSubItem_lastModify_uid { get; set; } = "";
    }



    [Table("modelMainItem")]
    public class modelMainItem
    {
        [JsonIgnore]
        [Key]
        public int modelMainItem_sn { get; set; }
        public string modelMainItem_uid { get; set; } = "";
        public string modelQuotation_uid { get; set; } = "";
        public string mainItem_uid { get; set; } = "";
        public string modelMainItem_name { get; set; } = "";
        public double modelMainItem_ac { get; set; } = 0.0;
        public double modelMainItem_subTotal { get; set; } = 0.0;
        public DateTime modelMainItem_createdate { get; set; } = DateTime.Now;
        public DateTime modelMainItem_modifydate { get; set; } = DateTime.Now;
        public string modelMainItem_lastModify_uid { get; set; } = "";
    }

    [Table("modelQuotation")]
    public class modelQuotation
    {
        [JsonIgnore]
        [Key]
        public int modelQuotation_sn { get; set; }
        public string modelQuotation_uid { get; set; } = "";
        public string dept_uid { get; set; } = "";
        public string modelProj_uid { get; set; } = "";
        public string modelQuotation_name { get; set; } = "";
        public string company_uid { get; set; } = "";
        public string contactPerson_uid { get; set; } = "";
        public DateTime modelQuotation_createdate { get; set; } = DateTime.Now;
        public DateTime modelQuotation_modifydate { get; set; } = DateTime.Now;
        public string modelQuotation_lastmodify_uid { get; set; } = "";
    }



    [Table("modelProj")]
    public class modelProj
    {
        [JsonIgnore]
        [Key]
        public int modelProj_sn { get; set; }
        public string dept_uid { get; set; } = "";
        public string modelProj_uid { get; set; } = "";
        public string modelProj_name { get; set; } = "";
        public DateTime modelProj_createdate { get; set; } = DateTime.Now;
        public DateTime modelProj_modifydate { get; set; } = DateTime.Now;
        public string modelProj_lastmodify_uid { get; set; } = "";
        public string modelProj_isdel { get; set; } = "";
    }

    [Table("contactPerson")]
    public class contactPerson
    {
        [JsonIgnore]
        [Key]
        public int contactPerson_sn { get; set; }
        public string company_uid { get; set; } = "";
        public string contactPerson_uid { get; set; } = "";
        public string contactPerson_name { get; set; } = "";
        public string contactPerson_email { get; set; } = "";
        public string contactPerson_tel { get; set; } = "";

        public string contactPerson_fax { get; set; } = "";
        public string contactPerson_isdel { get; set; } = "N";
        public DateTime contactPerson_createdate { get; set; } = DateTime.Now;
        public DateTime contactPerson_modifydate { get; set; } = DateTime.Now;
        public string contactPerson_lastmodify_uid { get; set; } = "";
    }



    [Table("company")]
    public class company
    {
        [JsonIgnore]
        [Key]
        public int company_sn { get; set; }
        public string company_uid { get; set; } = "";
        public string company_name { get; set; } = "";
        public string company_serialNo { get; set; } = "";
        public string company_address { get; set; } = "";
        public string company_tel { get; set; } = "";
        public string company_fax { get; set; } = "";
        public string company_isdel { get; set; } = "N";
        public DateTime company_createdate { get; set; } = DateTime.Now;
        public DateTime company_modifydate { get; set; } = DateTime.Now;
        public string company_lastmodify_uid { get; set; } = "";
    }


    [Table("subItem")]
    public class subItem
    {
        [JsonIgnore]
        [Key]
        public int subItem_sn { get; set; }
        public string subItem_uid { get; set; } = "";
        public string mainItem_uid { get; set; } = "";
        public string subItem_name { get; set; } = "";
        public string subItem_descript { get; set; } = "";
        public double subItem_price { get; set; } = 0.0;
        public string subItem_unitType { get; set; } = "";
        public DateTime subItem_createdate { get; set; } = DateTime.Now;
        public DateTime subItem_modifydate { get; set; } = DateTime.Now;
        public string subItem_lastmodify_uid { get; set; } = "";
    }

    [Table("mainItem")]
    public class mainItem
    {
        [JsonIgnore]
        [Key]
        public int mainItem_sn { get; set; }
        public string mainItem_uid { get; set; } = "";
        public string dept_uid { get; set; } = "";
        public string mainItem_name { get; set; } = "";
        public DateTime mainItem_createdate { get; set; } = DateTime.Now;
        public DateTime mainItem_modifydate { get; set; } = DateTime.Now;
        public string mainItem_lastmodify_uid { get; set; } = "";
    }

    [Table("userDept")]
    public class userDept
    {
        [JsonIgnore]
        [Key]
        public int userDept_sn { get; set; }
        public string user_uid { get; set; } = "";
        public string dept_uid { get; set; } = "";
        public DateTime userDept_createdate { get; set; } = DateTime.Now;
    }

    [Table("depts")]
    public class depts
    {
        [JsonIgnore]
        [Key]
        public int dept_sn { get; set; }
        public string dept_name { get; set; } = "";
        public string dept_uid { get; set; } = "";
        public string dept_code { get; set; } = "";
        public int dept_order { get; set; } = 0;
        public DateTime dept_createdate { get; set; } = DateTime.Now;
    }

    [Table("groupUser")]
    public class groupUser
    {
        [JsonIgnore]
        [Key]
        public int groupUser_sn { get; set; }
        public string groupUser_uid { get; set; } = "";
        public string group_uid { get; set; } = "";
        public string user_uid { get; set; } = "";
        public string dept_uid { get; set; } = "";
        public DateTime groupUser_createdate { get; set; } = DateTime.Now;
    }

    [Table("[group]")]
    public class group
    {
        [JsonIgnore]
        [Key]
        public int group_sn { get; set; }

        public string dept_uid { get; set; } = "";
        public string group_uid { get; set; } = "";
        public string group_name { get; set; } = "";
   
        public DateTime group_createdate { get; set; } = DateTime.Now;
    }


[Table("token")]
    public class token
    {
        [JsonIgnore]
        [Key]
        public int token_sn { get; set; }

        public string token_key { get; set; } = "";

        public string user_uid { get; set; } = "";

        public string user_id { get; set; } = "";

        public string token_isremember { get; set; } = "N";

        public DateTime token_createdate { get; set; } = DateTime.Now;

        public DateTime token_expireddate { get; set; } = DateTime.Now.AddMinutes(20);

    }

    [Table("users")]
    public class user
    {
        [JsonIgnore]
        [Key]
        public int user_sn { get; set; }

        public string user_uid { get; set; } = "";

        public string user_id { get; set; } = "";

        public string user_name { get; set; } = "";

        public string user_engName { get; set; } = "";

        public string user_email { get; set; } = "";

        public string user_onjob { get; set; } = "N";

        public string user_type { get; set; } = "N";

        public string user_pwd { get; set; } = "";

        public string user_perm { get; set; } = "user";

        public string user_pic { get; set; } = "";

        public string user_ishidden { get; set; } = "N";

        public DateTime user_createdate { get; set; } = DateTime.Now;

        public string user_lastlogintime { get; set; } = "";

    }

    [Table("new_userdata")]
    public class new_userdata
    {
        [JsonIgnore]
        [Key]
        public int usersn { get; set; }

        public string userid { get; set; } = "";

        public string userpw { get; set; } = "";

        public string username { get; set; } = "";

        public int maincategoryid { get; set; } = 1;

        public int subcategoryid { get; set; } = 1;

        public int grade { get; set; } = 0;

        public string mail { get; set; } = "";

        public string mailto { get; set; } = "";

        public int onjob { get; set; } = 0;

        public int permission { get; set; } = 0;

    }

}
