using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;

namespace LifePayment.Domain
{
    public class FundTransPagePayInput
    {
        /// <summary>
        /// 商户端的唯一订单号,对于同一笔转账请求,商户需保证该订单号唯一。
        /// </summary>
        [JsonProperty("out_biz_no", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string OutBizNo
        {
            get;
            set;
        }

        /// <summary>
        /// 订单总金额,单位为元,精确到小数点后两位,取值范围[0.01,9999999999999.99]
        /// </summary>
        [JsonProperty("trans_amount", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public decimal TransAmount
        {
            get;
            set;
        }

        /// <summary>
        /// 销售产品码,商家和支付宝签约的产品码
        /// </summary>
        [JsonProperty("product_code", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string ProductCode
        {
            get;
            set;
        }

        /// <summary>
        /// 描述特定的业务场景,比如对党费缴纳场景需走党费专户
        /// </summary>
        [JsonProperty("biz_scene", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string BizScene
        {
            get;
            set;
        }

        /// <summary>
        /// 收款方信息
        /// </summary>
        [JsonProperty("payee_info", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public Participant PayeeInfo
        {
            get;
            set;
        }

        /// <summary>
        /// 转账备注
        /// </summary>
        [JsonProperty("remark", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string Remark
        {
            get;
            set;
        }

        /// <summary>
        /// 支付宝订单号,仅批量有密场景下生效
        /// </summary>
        [JsonProperty("order_id", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string OrderId
        {
            get;
            set;
        }

        /// <summary>
        /// 付款方信息
        /// </summary>
        [JsonProperty("payer_info", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public Participant PayerInfo
        {
            get;
            set;
        }

        /// <summary>
        /// 转账订单的标题,用于在收银台和消费记录展示
        /// </summary>
        [JsonProperty("order_title", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string OrderTitle
        {
            get;
            set;
        }

        /// <summary>
        /// 支付绝对超时时间,格式为yyyy-MM-dd HH:mm
        /// </summary>
        [JsonProperty("time_expire", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string TimeExpire
        {
            get;
            set;
        }

        /// <summary>
        /// 自动退款绝对超时时间,格式为yyyy-MM-dd HH:mm
        /// </summary>
        [JsonProperty("refund_time_expire", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string RefundTimeExpire
        {
            get;
            set;
        }

        /// <summary>
        /// 公用回传参数,如果请求时传递了该参数,则异步通知商户时会回传该参数。
        /// </summary>
        [JsonProperty("passback_params", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string PassbackParams
        {
            get;
            set;
        }

        /// <summary>
        /// JSON格式,传递业务扩展参数,使用前请与支付宝工程师联系!
        /// </summary>
        [JsonProperty("business_params", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string BusinessParams
        {
            get;
            set;
        }
    }

    public class Participant
    {
        /// <summary>
        /// 收款方账号或付款方账号,传入支付宝uid 参与方的标识,单笔无密转账到银行卡固定为收款方银行卡号
        /// </summary>
        [JsonProperty("identity", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string Identity
        {
            get;
            set;
        }

        /// <summary>
        /// identity传入支付宝uid时为:LAIPAY_USER_ID 参与方的标识类型,单笔无密转账到银行卡固定为BANKCARD_ACCOUNT
        /// </summary>
        [JsonProperty("identity_type", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string IdentityType
        {
            get;
            set;
        }

        /// <summary>
        /// 参与方的证件号,支持身份证号、护照号。
        /// </summary>
        [JsonProperty("cert_no", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string CertNo
        {
            get;
            set;
        }

        /// <summary>
        /// 参与方的证件类型。
        /// </summary>
        [JsonProperty("cert_type", NullValueHandling = NullValueHandling.Ignore)]
        [Required]
        public string CertType
        {
            get;
            set;
        }

        /// <summary>
        /// 参与方真实姓名,如果非空,将校验收款支付宝账号姓名一致性。当identity_type=ALIPAY_LOGON_ID时,本字段必填。
        /// 收款方银行账户名称
        /// </summary>
        [JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
        public string Name
        {
            get;
            set;
        }

        /// <summary>
        /// 描述参与方信息的扩展属性,使用前请与支付宝工程师确认
        /// </summary>
        [JsonProperty("ext_info", NullValueHandling = NullValueHandling.Ignore)]
        public string ExtInfo
        {
            get;
            set;
        }

        [JsonProperty("bankcard_ext_info", NullValueHandling = NullValueHandling.Ignore)]
        public BankcardExtInfo BankCardExtInfo
        {
            get;
            set;
        }
    }

    public class BankcardExtInfo
    {
        /// <summary>
        /// 当收款账户为对公账户时,机构名称必填;当收款账户为对私账户时,机构名称可为空。 如:交通银行
        /// </summary>
        [JsonProperty("inst_name", NullValueHandling = NullValueHandling.Ignore)]
        public string InstName
        {
            get;
            set;
        }

        /// <summary>
        /// 收款账户类型。
        /// 1:对公(在金融机构开设的公司账户),如果银行卡为对公,必须传递省市支行信息或者联行号
        /// 2:对私(在金融机构开设的个人账户)
        /// </summary>
        [JsonProperty("account_type", NullValueHandling = NullValueHandling.Ignore)]
        public string AccountType
        {
            get;
            set;
        }

        /// <summary>
        /// 银行所在省份
        /// </summary>
        [JsonProperty("inst_province", NullValueHandling = NullValueHandling.Ignore)]
        public string InstProvince
        {
            get;
            set;
        }

        /// <summary>
        /// 收款银行所在市
        /// </summary>
        [JsonProperty("inst_city", NullValueHandling = NullValueHandling.Ignore)]
        public string InstCity
        {
            get;
            set;
        }

        /// <summary>
        /// 收款银行所属支行
        /// </summary>
        [JsonProperty("inst_branch_name", NullValueHandling = NullValueHandling.Ignore)]
        public string InstBranchName
        {
            get;
            set;
        }

        /// <summary>
        /// 银行支行联行号
        /// </summary>
        [JsonProperty("bank_code", NullValueHandling = NullValueHandling.Ignore)]
        public string BankCode
        {
            get;
            set;
        }
    }
}