package com.yuchen.saas.payment.api.entity.invoice;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yuchen.saas.payment.api.dto.invoice.RhSaasInvoiceOrderItem;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nest.springwrap.core.mp.base.BaseEntity;

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

/**
 * <p>
 * 开票订单主表
 * </p>
 *
 * @author xuzy
 * @since 2023-09-13
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("saas_invoice_order")
@ApiModel(value="SassInvoiceOrder对象", description="开票订单主表")
public class SaasInvoiceOrder extends BaseEntity {

    /**
     * 微信openid or 用户ID
     */
    @ApiModelProperty(name = "payUserId", value = "微信openid or 用户ID")
    private String payUserId;
    /**
     * 平台用户ID
     */
    @ApiModelProperty(name = "userDetailId", value = "平台用户ID")
    private Long userDetailId;
    /**
     * rh请求流水号
     */
    @ApiModelProperty(name = "serialNo", value = "rh请求流水号")
    private String serialNo;
    /**
     * 订单中心订单ID
     */
    @ApiModelProperty(name = "saasOrderNo", value = "订单中心订单ID")
    private String saasOrderNo;
    /**
     * 订单类型 1or3:临停 2:月卡 20:错时卡 26:充电 30:占位费
     */
    @ApiModelProperty(name = "orderType", value = "订单类型 1or3:临停 2:月卡 20:错时卡 26:充电 30:占位费")
    private Integer orderType;
    /**
     * 订单号
     */
    @ApiModelProperty(name = "orderNo", value = "订单号")
    private String orderNo;
    /**
     * 运营商ID
     */
    @ApiModelProperty(name = "enterpriseId", value = "运营商ID")
    private Long enterpriseId;
    /**
     * 园区ID
     */
    @ApiModelProperty(name = "parkId", value = "园区ID")
    private Long parkId;
    /**
     * 场站ID（停车场、充电站、单元楼等）
     */
    @ApiModelProperty(name = "siteId", value = "场站ID（停车场、充电站、单元楼等）")
    private Long siteId;
    /**
     * 发票种类(1:普通发票(数电) 2:增值税电子普通发票(税控))
     */
    @ApiModelProperty(name = "saasInvoiceType", value = "发票种类(1:普通发票(数电) 2:增值税电子普通发票(税控))")
    private String saasInvoiceType;
    /**
     * 开票类型(p:电子增值税普通发票(默认) ps:电子收购发票 c:纸质普通发票 cs:纸质收购票 s:增值税专用发票 py:成品油 q:全电普票(数电普票) w:全电专票(数电专票) qs:全电收购)
     */
    @ApiModelProperty(name = "invoiceType", value = "开票类型(p:电子增值税普通发票(默认) ps:电子收购发票 c:纸质普通发票 cs:纸质收购票 s:增值税专用发票 py:成品油 q:全电普票(数电普票) w:全电专票(数电专票) qs:全电收购)")
    private String invoiceType;
    /**
     * 抬头类型(1:个人 2:企业)
     */
    @ApiModelProperty(name = "invoiceHeadType", value = "抬头类型(1:个人 2:企业)")
    private Integer invoiceHeadType;
    /**
     * 开票人
     */
    @ApiModelProperty(name = "drawer", value = "开票人")
    private String drawer;
    /**
     * 开票方式(1:手动开票 2:自动开票)
     */
    @ApiModelProperty(name = "buildType", value = "开票方式(1:手动开票 2:自动开票)")
    private Integer buildType;
    /**
     * 开票方ID
     */
    @ApiModelProperty(name = "invoiceBodyId", value = "开票方ID")
    private Long invoiceBodyId;
    /**
     * 开票方名称
     */
    @ApiModelProperty(name = "invoicePartyName", value = "开票方名称")
    private String invoicePartyName;
    /**
     * 开票人电话
     */
    @ApiModelProperty(name = "personPhone", value = "开票人电话")
    private String personPhone;
    /**
     * 开票人电子邮箱
     */
    @ApiModelProperty(name = "email", value = "开票人电子邮箱")
    private String email;
    /**
     * 开票时间
     */
    @ApiModelProperty(name = "orderTime", value = "开票时间")
    private String orderTime;
    /**
     * 申请时间
     */
    @ApiModelProperty(name = "applyTime", value = "申请时间")
    private Date applyTime;
    /**
     * 成功时间
     */
    @ApiModelProperty(name = "successTime", value = "成功时间")
    private Date successTime;
    /**
     * 开票状态(0:开票中 1:开票成功 2:开票失败 3:红冲中(待退票) 4:已红冲(已退票) 5:被驳回 6:重开发票申请中 7:待作废 8:已作废 9:未开票 10:被驳回且重新申请 11:待红冲 12:红冲失败)
     */
    @ApiModelProperty(name = "invoiceStatus", value = "开票状态(0:开票中 1:开票成功 2:开票失败 3:红冲中(待退票) 4:已红冲(已退票) 5:被驳回 6:重开发票申请中 7:待作废 8:已作废 9:未开票 10:被驳回且重新申请 11:待红冲 12:红冲失败)")
    private Integer invoiceStatus;

    /**
     * 销货方纳税人识别号
     */
    @ApiModelProperty(name = "taxpayerCode", value = "销货方纳税人识别号")
    private String taxpayerCode;
    /**
     * 购货方名称，即发票抬头
     */
    @ApiModelProperty(name = "customerName", value = "购货方名称，即发票抬头")
    private String customerName;
    /**
     * 购货方纳税人识别号号
     */
    @ApiModelProperty(name = "customerCode", value = "购货方纳税人识别号号")
    private String customerCode;
    /**
     * 购货方地址
     */
    @ApiModelProperty(name = "customerAddress", value = "购货方地址")
    private String customerAddress;
    /**
     * 购货方电话
     */
    @ApiModelProperty(name = "customerTel", value = "购货方电话")
    private String customerTel;
    /**
     * 购货方开户银行
     */
    @ApiModelProperty(name = "customerBankName", value = "购货方开户银行")
    private String customerBankName;
    /**
     * 购货方银行账号
     */
    @ApiModelProperty(name = "customerBankAccount", value = "购货方银行账号")
    private String customerBankAccount;

    /**
     * 红冲订单id
     */
    @ApiModelProperty(name = "validSaasInvoiceId", value = "红冲订单id")
    private Long validSaasInvoiceId;
    /**
     * 发票代码＋发票号码。（开票类型为增值税发票时后8位为发票号码，其余为发票代码；开票类型为全电发票时是20位的发票号码）
     */
    @ApiModelProperty(name = "orderCode", value = "发票代码＋发票号码。（开票类型为增值税发票时后8位为发票号码，其余为发票代码；开票类型为全电发票时是20位的发票号码）")
    private String orderCode;
    /**
     * 税价合计金额
     */
    @ApiModelProperty(name = "totalAmount", value = "税价合计金额")
    private BigDecimal totalAmount;
    /**
     * 不含税金额
     */
    @ApiModelProperty(name = "noTaxAmount", value = "不含税金额")
    private BigDecimal noTaxAmount;
    /**
     * 税额
     */
    @ApiModelProperty(name = "taxAmount", value = "税额")
    private BigDecimal taxAmount;
    /**
     * 红冲总金额
     */
    @ApiModelProperty(name = "validTotalAmount", value = "红冲总金额")
    private BigDecimal validTotalAmount;
    /**
     * 红冲税价合计金额
     */
    @ApiModelProperty(name = "validNoTaxAmount", value = "红冲税价合计金额")
    private BigDecimal validNoTaxAmount;
    /**
     * 红冲税额1
     */
    @ApiModelProperty(name = "validTaxAmount", value = "红冲税额")
    private BigDecimal validTaxAmount;
    /**
     * 备注
     */
    @ApiModelProperty(name = "remark", value = "备注")
    private String remark;

    /**
     * PDF下载URL
     */
    @ApiModelProperty(name = "pdfUnsignedUrl", value = "PDF下载URL")
    private String pdfUnsignedUrl;
    /**
     * PDF查看URL
     */
    @ApiModelProperty(name = "pdfViewUrl", value = "PDF查看URL")
    private String pdfViewUrl;
    /**
     * 红冲原因
     */
    @ApiModelProperty(name = "validReason", value = "红冲原因")
    private String validReason;
    /**
     * 红冲发票pdfurl
     */
    @ApiModelProperty(name = "validPdfUrl", value = "红冲发票pdfurl")
    private String validPdfUrl;
    /**
     * 红冲发票查看url
     */
    @ApiModelProperty(name = "validViewUrl", value = "红冲发票查看url")
    private String validViewUrl;
    /**
     * 红冲发票编号
     */
    @ApiModelProperty(name = "validOrderCode", value = "红冲发票编号")
    private String validOrderCode;
    /**
     * 红冲时间
     */
    @ApiModelProperty(name = "validTime", value = "红冲时间")
    private String validTime;
    /**
     * 三方接口开票返回消息
     */
    @ApiModelProperty(name = "invokeMessage", value = "三方接口开票返回消息")
    private String invokeMessage;
    /**
     * 驳回原因
     */
    @ApiModelProperty(name = "reason", value = "驳回原因")
    private String reason;

    @TableField(exist = false)
    private Boolean autoBilling;

    @TableField(exist = false)
    private Map<String, String> extendedParams;

    /**
     * 订单明细
     */
    @TableField(exist = false)
    private List<RhSaasInvoiceOrderItem> orderItems;
}
