package cn.superdesk.uniorder.openapi.api._thirdpart.qchjc._dto.invoice;

import cn.superdesk.uniorder.openapi.api._thirdpart.qchjc._dto.accounting.QchjcCustomerOrderDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author xc
 * @description 采购单位发票单
 * @date 2022/3/18 19:10
 */
@Data
public class QchjcCustomerInvoiceDto {
    /**
     * 对账单
     */
    @NotNull(message = "不能为空")
    private Long       accountingOrderId;//对账单Id
    @NotBlank(message = "不能为空")
    private String     accountingOrderSn;//对账单编号
    private Integer    accountingOrderType;//对账单类型 1-一般 2-积分 ，默认2-积分
    @NotBlank(message = "不能为空")
    private String     invoiceSn;//发票单编号
    /**
     * 寄票登记
     */
    private String     mailTickUserId;//寄票登记人id
    private Integer    mailTickStatus;//寄票状态:0-未寄票;1-已寄票
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date       mailTickTime;//寄票时间
    private String     expressCompanyName;//快递公司名称
    private String     expressNo;//快递单号
    /**
     * 开票申请
     */
    @NotNull(message = "不能为空")
    @DecimalMin(value = "0", message = "金额需大于等于0.00")
    private BigDecimal invoiceApplyAmount;//开票申请金额:商品或流水累加
    @NotNull(message = "不能为空")
    @DecimalMin(value = "0", message = "金额需大于等于0.00")
    private BigDecimal freeAmount;//减免金额
    //    @NotNull(message = "不能为空")
//    @DecimalMin(value = "0", message = "金额需大于等于0.00")
//    private BigDecimal unAccountingAmount;//取该对账单中所有积分类型为`微信支付`的结算金额总和 也称之为不对账金额 不结算金额 默认0
//    @NotNull(message = "不能为空")
//    @DecimalMin(value = "0", message = "金额需大于等于0.00")
//    private BigDecimal  jcUnAccountingAmount;//集采不对账金额
    @NotNull(message = "不能为空")
    @DecimalMin(value = "0", message = "金额需大于等于0.00")
    private BigDecimal realAmount;//实际金额
    @NotBlank(message = "不能为空")
    private String     invoiceMode;//开票方式 线下开票(offLine)|深圳航天信息电子发票(szhtxxElectronicInvoice)|深圳航信纸质发票(szhtxxPaperInvoice）
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message = "不能为空")
    private Date       applyTime;//申请时间
    @NotNull(message = "不能为空")
    private String     applyUserId;//申请人id
    @NotBlank(message = "不能为空")
    private String     applyUserName;//申请人姓名
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message = "不能为空")
    private Date       updateTime;//最后修改时间
    @NotNull(message = "不能为空")
    private String     updateUserId;//最后修改人id
    @NotBlank(message = "不能为空")
    private String     updateUserName;//最后修改人姓名
    private String     remark;//备注

    /**
     * 购方 - 扩展信息 SysEnterpriseExtInvocie
     */
    private String  invoiceSendEmail;//发票交付邮箱，深圳航信电子发票开票方式时传，若不传不交付
    @NotNull(message = "不能为空")
    private Integer selectedInvoiceTitle;//发票类型:4个人,5单位
    @NotNull(message = "不能为空")
    private Integer invoiceState;//开票方式(1为随货开票,0为订单预借,2为集中开票 )
    @NotNull(message = "不能为空")
    private Long    invoiceType;//发票种类 1-增值税电子普通发票，2-增值税专用发票，3-增值税普通发票，4-增值税电子专用发票
    @NotBlank(message = "不能为空")
    private String  companyName;//发票抬头 (如果selectedInvoiceTitle=5则此字段必须)
    @NotBlank(message = "不能为空")
    private String  taxpayersIDCode;//纳税人识别号
    @NotNull(message = "不能为空")
    private Integer invoiceContent;//1:明细,3:电脑配件,19:耗材,22:办公用品 备注:若增值发票则只能选1 明细 固定22
    private String  invoiceName;//增值票收票人姓名 当invoiceType=2 且invoiceState=1时则此字段必填
    private String  invoicePhone;//增值票收票人电话 备注:当invoiceType=2 且invoiceState=1时则此字段必填
    ///@NotBlank(message = "不能为空")
    private String  contactsName;//联系人-名称
    //@NotBlank(message = "不能为空")
    private String  contactsPhone;//联系人电话
    private String  invoiceProvice;//增值票收票人所在省 备注:当invoiceType=2 且invoiceState=1时则此字段必填
    private String  invoiceCity;//增值票收票人所在市 备注:当invoiceType=2 且invoiceState=1时则此字段必填
    private String  invoiceCounty;//增值票收票人所在区/县 备注:当invoiceType=2 且invoiceState=1时则此字段必填
    private String  invoiceAddress;//增值票收票人所在地址 备注:当invoiceType=2 且invoiceState=1时则此字段必填
    private String  invoiceAddressPhone;//复合字段 地址电话
    private String  invoiceBankAccountNumber;//复合字段 银行名称与账号
    private String  invoiceBank;//增值票开户银行
    private String  invoiceAccount;//增值票开户帐号

    @ApiModelProperty("订单dto为引用值 List<QchjcOrderDto>")
    @NotEmpty(message = "不能为空")
    @Valid
    private List<QchjcCustomerOrderDto> orderSelected;
}