package com.zt.plat.module.contractorder.api.vo.contract;

import cn.hutool.json.JSONArray;
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscDatBsnSaveReqVO;
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscItmBsnSaveReqVO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;


import java.math.BigDecimal;
import java.util.List;

@Schema(description = "管理后台 - 合同信息新增/修改 Request VO")
@Data
public class ContractSaveReqVO {

    @Schema(description = "主键，新增时为空，修改时需要有值")
    private Long id;

    @NotNull(message = "步骤不能为空")
    @Schema(description = "步骤", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Integer step;

    @Schema(description = "交货地点")
    private String deliveryAddress;

    @Schema(description = "交货方式(字典:FRCST_ASN)")
    private String deliveryWay;

    @Schema(description = "附件对象存储")
    private JSONArray fileObject;

    @Schema(description = "其它附件对象存储")
    private JSONArray fileObjectOther;

    @Schema(description = "甲方公司编号;如果是采购合同，查询组织机构自动带出，且与ERP(HTQDZTBH)对应，如果是销售合同，手动选择，且与ERP(WLDWBH)对应。", example = "甲方公司编号")
    private String purchaseCompanyNumber;

    @Schema(description = "甲方公司名称", example = "甲方公司名称")
    private String purchaseCompanyName;

    @Schema(description = "甲方地址", example = "甲方地址")
    private String purchaseAddress;

    @Schema(description = "甲方法定代表人", example = "甲方法定代表人")
    private String purchaseLeader;

    @Schema(description = "甲方联系人", example = "甲方联系人")
    private String purchaseHuman;

    @Schema(description = "甲方电话", example = "甲方电话")
    private String purchaseTel;

    @Schema(description = "甲方邮箱", example = "甲方邮箱")
    private String purchaseEmail;

    @Schema(description = "甲方传真", example = "甲方传真")
    private String purchaseFax;

    @Schema(description = "甲方联系地址", example = "甲方联系地址")
    private String purchaseContactAddress;

    @Schema(description = "乙方公司编号;如果是销售合同，查询组织机构自动带出，且与ERP(HTQDZTBH)对应，如果是采购合同，手动选择，且与ERP(WLDWBH)对应。", example = "乙方公司编号")
    private String salesCompanyNumber;

    @Schema(description = "乙方公司名称", example = "乙方公司名称")
    private String salesCompanyName;

    @Schema(description = "乙方地址", example = "乙方地址")
    private String salesAddress;

    @Schema(description = "乙方企业负责人", example = "乙方企业负责人")
    private String salesPurchaseLeader;

    @Schema(description = "乙方联系人", example = "乙方联系人")
    private String salesHuman;

    @Schema(description = "乙方电话", example = "乙方电话")
    private String salesTel;

    @Schema(description = "乙方邮箱", example = "乙方邮箱")
    private String salesEmail;

    @Schema(description = "乙方传真", example = "乙方传真")
    private String salesFax;

    @Schema(description = "乙方联系地址", example = "乙方联系地址")
    private String salesContactAddress;

    @NotBlank(message = "合同名称不能为空")
    @Size(max = 90, message = "合同名称长度不能超过90个字符")
    @Schema(description = "合同名称;与ERP(HTMC)对应，校验唯一", example = "合同名称")
    private String contractName;

    @Schema(description = "合同编号;与ERP(HTBH)对应，校验唯一", example = "合同编号")
    private String contractPaperNumber;

    @Schema(description = "合同类型", example = "PRCH")
    private String contractType;

    @Schema(description = "收支性质;与ERP(SZXZ)对应", example = "EXPENSES")
    private String direction;

    @Schema(description = "签署日期;与ERP(HTQDRQ)对应")
    private String signDate;

    @Schema(description = "开始日期;与ERP(HTQSRQ)对应")
    private String startDate;

    @Schema(description = "结束日期;与ERP(HTZZRQ)对应")
    private String endDate;

    @Schema(description = "签署地", example = "签署地")
    private String signPlace;

    @Schema(description = "币种;与ERP(BZBH)对应", example = "CNY")
    private String currency;

    @Schema(description = "本币金额;与ERP(HTBWBZJE)对应")
    private BigDecimal basicAmount;

    @Schema(description = "原币金额;与ERP(HTYBZJE)对应，币种不是人民币时，显示并手动填写，如果是人民币，隐藏且等于本币金额")
    private BigDecimal cooAmount;

    @Schema(description = "是否有履约保证金;为是，则保证金必填。", example = "1")
    private String hasDeposit;

    @Schema(description = "原币履约保证金;与ERP(LYBZJBGQYB)对应，币种不是人民币时，显示并手动填写，如果是人民币，隐藏且等于本币金额")
    private BigDecimal cooAmountDeposit;

    @Schema(description = "本币履约保证金-变更后;与ERP(LYBZJBGHBWB)对应，拓展信息")
    private BigDecimal changeBasicAmountDeposit;

    @Schema(description = "是否有预付款;与ERP(SFYYFK)对应", example = "1")
    private String hasPrepayment;

    @Schema(description = "预付款比例;与ERP(YFKBL)对应")
    private BigDecimal prepaymentRatio;

    @Schema(description = "预付款金额;与ERP(YFKJE)对应")
    private BigDecimal prepaymentAmount;

    @Schema(description = "是否有质保金;与ERP(SFHZBJ)对应", example = "1")
    private String hasQualityAmount;

    @Schema(description = "质保金比例;与ERP(ZBJBL)对应")
    private BigDecimal qualityRatio;

    @Schema(description = "质保金金额;与ERP(BZJJE)对应")
    private BigDecimal qualityAmount;

    @Schema(description = "是否先款后货", example = "1")
    private String hasPayable;

    @Schema(description = "备注;与ERP(BZXX)对应", example = "备注")
    private String remark;

    @Schema(description = "原币金额-变更后;与ERP(BGHHTYBZJE)对应，拓展信息")
    private BigDecimal changeCooAmount;

    @Schema(description = "本币金额-变更后;与ERP(BGHHTBWBZJE)对应，拓展信息")
    private BigDecimal changeBasicAmount;

    @Schema(description = "原币履约保证金-变更后;与ERP(LYBZJBGHYB)对应，拓展信息")
    private BigDecimal changeCooAmountDeposit;

    @Schema(description = "本币履约保证金;与ERP(LYBZJBGQBWB)对应")
    private BigDecimal basicAmountDeposit;

    @Schema(description = "是否框架合同;与ERP(SFKJHT)对应，拓展信息", example = "1")
    private String isFramework;

    @Schema(description = "境内/境外;与ERP(JNJW)对应，拓展信息", example = "DOMESTIC")
    private String isDomestic;

    @Schema(description = "施工类型编号;与ERP(HTLXBH)对应，拓展信息", example = "施工类型编号")
    private String constructionTypeNumber;

    @Schema(description = "施工类型名称;与ERP(HTLXMC)对应，拓展信息", example = "施工类型名称")
    private String constructionTypeName;

    @Schema(description = "代理方;与ERP(ZLIFNR)对应，拓展信息", example = "代理方")
    private String agent;

    @NotBlank(message = "合同类别不能为空")
    @Schema(description = "类别;与ERP(HTLB)对应，拓展信息", example = "PROCESSING")
    private String category;

    @Schema(description = "是否虚拟合同;与ERP(SFXNHT)对应", example = "1")
    private String contractVirtual;

    @Schema(description = "补充协议类型;变更协议/增加条款", example = "补充协议类型")
    private String replenishAgreementType;

    @Schema(description = "建筑服务发生地;与ERP(JZFWFSD)对应，拓展信息，销售合同，且类型为SAP02COSR必填", example = "建筑服务发生地")
    private String architectureServicePlace;

    @Schema(description = "达到收款条件金额;与ERP(DDSKJE)对应，拓展信息，销售合同，且类型为SAP02COSR必填")
    private BigDecimal payeeConditionAmount;

    @Schema(description = "是否内部企业(字典：ERP_CTRT_YN)")
    private String isInternal;

    @Schema(description = "模板实例主键", example = "10196")
    private Long instanceId;

    @Schema(description = "合同分类(字典：SPLY_BSN_TP)")
    private String businessType;

    @Schema(description = "代理方名称")
    private String agentName;

    @Schema(description = "货权转移类型(字典：ASY_MTNG_TP)")
    private String meteringType;

    @Schema(description = "模板中间表ID")
    private Long businessId;

    @Schema(description = "甲方户名")
    private String purchaseAccountName;

    @Schema(description = "甲方开户行")
    private String purchaseBankAccount;

    @Schema(description = "甲方户号")
    private String purchaseAccountNumber;

    @Schema(description = "甲方税号/社会信用代码")
    private String purchaseTaxNumber;

    @Schema(description = "乙方户名")
    private String salesAccountName;

    @Schema(description = "乙方开户行")
    private String salesBankAccount;

    @Schema(description = "乙方户号")
    private String salesAccountNumber;

    @Schema(description = "乙方税号/社会信用代码")
    private String salesTaxNumber;
    @Schema(description = "是否信用", example = "1")
    private String hasCredit;
    //资金拆分表
    private List<AmountDismantleSaveReqVO> amountSplit;
    // 收发货规则
    private List<ContractReceiveSendSaveReqVO> contractReceiveSends;

    // 物料信息
    private List<DetailSaveReqVO> detail;

    // 合同动态字段
    private List<TmplInscDatBsnSaveReqVO> dynamicsFields;

    // 合同动态条款
    private List<TmplInscItmBsnSaveReqVO> dynamicsItems;

    // 价款结算条款
    private List<FormulaSaveReqVO> formulas;

    // 参数降级规则
    private List<DemoteSaveReqVO> demotes;

    // 品位不计价规则
    private List<NotSaveReqVO> nots;
}