package com.kym.entity.miniapp;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.kym.entity.BaseEntity;
import com.kym.entity.typehandle.InvoiceOrderDetailListTypeHandle;
import com.kym.entity.wechat.InvoiceOrderDetail;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * <p>
 * 发票记录表
 * </p>
 *
 * @author skyline
 * @since 2023-09-15
 */
@Setter
@Getter
@NoArgsConstructor
@TableName(schema = "charge_app", value = "t_invoice", autoResultMap = true)
@Accessors(chain = true)
public class Invoice extends BaseEntity {
    public static final String TYPE_个人 = "INDIVIDUAL";
    public static final String TYPE_企业 = "ORGANIZATION";

    public static final int STATUS_待开票 = 0;
    public static final int STATUS_已开票 = 1;
    public static final int STATUS_已作废 = 2;
    public static final int STATUS_开票中 = 3;


    private static final long serialVersionUID = 1L;

    /**
     * 微信发票申请id
     */
    private String applyId;

    private Long userId;

    /**
     * 发票抬头填写人的openid
     */
    private String openid;

    /**
     * 发票关联订单详情
     */
    @TableField(typeHandler = InvoiceOrderDetailListTypeHandle.class)
    private List<InvoiceOrderDetail> orderDetails;

    /**
     * 累积充电量（度）
     */
    private Double totalPower;
    /**
     * 累积总金额（分）
     */
    private Integer totalMoney;
    /**
     * 累积电费（分）
     */
    private Integer elecMoney;
    /**
     * 累积服务费（分）
     */
    private Integer serviceMoney;
    /**
     * 服务费优惠金额（分）
     */
    private Integer serviceMoneyDiscount;
    /**
     * 接收发票邮箱
     */
    private String email;
    /**
     * 电话
     */
    private String phone;
    /**
     * 发票类型:INDIVIDUAL-个人 ORGANIZATION-企业
     */
    private String invoiceType;
    /**
     * 发票抬头
     */
    private String invoiceTitle;
    /**
     * 公司税号
     */
    private String taxId;
    /**
     * 公司地址
     */
    private String address;
    /**
     * 购买方电话
     */
    private String telephone;
    /**
     * 开户银行
     */
    private String bankName;
    /**
     * 银行账户
     */
    private String bankAccount;
    /**
     * 发票金额（单位：分）
     */
    private Integer invoiceAmount;
    /**
     * 税额详情信息
     */
    private String taxInfo;
    /**
     * 开票人
     */
    private String biller;
    /**
     * 发票状态
     */
    private Integer status;
    /**
     * 备注
     */
    private String remark;

}
