package com.huimv.employment.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 订单开票归档信息 {@code fe_order_invoice}。
 * <p>一单一条；开票归档办结时写入金额、税额、抬头与凭证链接。</p>
 */
@TableName("fe_order_invoice")
public class FeOrderInvoice {

    /** 表主键，自增 */
    @TableId(type = IdType.AUTO)
    private Long id;

    /** 用工订单 fe_employment_order.id */
    private Long orderId;

    /** 关联结算单 fe_settlement_order.id，可空 */
    private Long settlementId;

    /** 所属企业 fe_enterprise.id，可空 */
    private Long enterpriseId;

    /**
     * 发票类型。
     * <ul>
     *   <li>{@code vat_special}：增值税专用发票</li>
     *   <li>{@code vat_normal}：增值税普通发票</li>
     * </ul>
     */
    private String invoiceType;

    /** 税率，如 0.0600 表示 6% */
    private BigDecimal taxRate;

    /** 可开票金额（元），通常取自结算单预计开票额 */
    private BigDecimal billableAmount;

    /** 已开票金额（元），归档办结后一般为本次开票金额 */
    private BigDecimal invoicedAmount;

    /** 待开票金额（元）= 可开票 − 已开票 */
    private BigDecimal pendingAmount;

    /** 本次开票金额不含税（元） */
    private BigDecimal invoiceAmount;

    /** 税额（元），默认 开票金额 × 税率 */
    private BigDecimal taxAmount;

    /** 价税合计（元）= 开票金额 + 税额 */
    private BigDecimal totalWithTax;

    /** 开票抬头：企业名称 */
    private String companyName;

    /** 开票抬头：统一社会信用代码 / 纳税人识别号 */
    private String creditCode;

    /** 开户银行及账号（展示用） */
    private String bankAccountInfo;

    /** 发票号码，可选留痕 */
    private String invoiceNo;

    /** 完税凭证号，可选留痕 */
    private String taxVoucherNo;

    /** 增值税发票下载 URL（MVP 可为 Mock 路径） */
    private String invoiceFileUrl;

    /** 完税证明下载 URL（MVP 可为 Mock 路径） */
    private String taxFileUrl;

    /** 合规证据链下载 URL（MVP 可为 Mock 路径） */
    private String complianceFileUrl;

    /**
     * 开票状态。
     * <ul>
     *   <li>{@code draft}：草稿/预填未归档</li>
     *   <li>{@code issued}：已开具</li>
     *   <li>{@code archived}：已归档办结</li>
     * </ul>
     */
    private String invoiceStatus;

    /** 备注 */
    private String remark;

    /** 开票归档办结时间 */
    private LocalDateTime archivedAt;

    /** 办结人用户 ID（fe_user.id） */
    private Long archivedBy;

    /** 创建时间 */
    private LocalDateTime createTime;

    /** 更新时间 */
    private LocalDateTime updateTime;

    /** 逻辑删除：0=正常，1=已删除 */
    @TableLogic
    private Integer delFlag;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public Long getSettlementId() {
        return settlementId;
    }

    public void setSettlementId(Long settlementId) {
        this.settlementId = settlementId;
    }

    public Long getEnterpriseId() {
        return enterpriseId;
    }

    public void setEnterpriseId(Long enterpriseId) {
        this.enterpriseId = enterpriseId;
    }

    public String getInvoiceType() {
        return invoiceType;
    }

    public void setInvoiceType(String invoiceType) {
        this.invoiceType = invoiceType;
    }

    public BigDecimal getTaxRate() {
        return taxRate;
    }

    public void setTaxRate(BigDecimal taxRate) {
        this.taxRate = taxRate;
    }

    public BigDecimal getBillableAmount() {
        return billableAmount;
    }

    public void setBillableAmount(BigDecimal billableAmount) {
        this.billableAmount = billableAmount;
    }

    public BigDecimal getInvoicedAmount() {
        return invoicedAmount;
    }

    public void setInvoicedAmount(BigDecimal invoicedAmount) {
        this.invoicedAmount = invoicedAmount;
    }

    public BigDecimal getPendingAmount() {
        return pendingAmount;
    }

    public void setPendingAmount(BigDecimal pendingAmount) {
        this.pendingAmount = pendingAmount;
    }

    public BigDecimal getInvoiceAmount() {
        return invoiceAmount;
    }

    public void setInvoiceAmount(BigDecimal invoiceAmount) {
        this.invoiceAmount = invoiceAmount;
    }

    public BigDecimal getTaxAmount() {
        return taxAmount;
    }

    public void setTaxAmount(BigDecimal taxAmount) {
        this.taxAmount = taxAmount;
    }

    public BigDecimal getTotalWithTax() {
        return totalWithTax;
    }

    public void setTotalWithTax(BigDecimal totalWithTax) {
        this.totalWithTax = totalWithTax;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getCreditCode() {
        return creditCode;
    }

    public void setCreditCode(String creditCode) {
        this.creditCode = creditCode;
    }

    public String getBankAccountInfo() {
        return bankAccountInfo;
    }

    public void setBankAccountInfo(String bankAccountInfo) {
        this.bankAccountInfo = bankAccountInfo;
    }

    public String getInvoiceNo() {
        return invoiceNo;
    }

    public void setInvoiceNo(String invoiceNo) {
        this.invoiceNo = invoiceNo;
    }

    public String getTaxVoucherNo() {
        return taxVoucherNo;
    }

    public void setTaxVoucherNo(String taxVoucherNo) {
        this.taxVoucherNo = taxVoucherNo;
    }

    public String getInvoiceFileUrl() {
        return invoiceFileUrl;
    }

    public void setInvoiceFileUrl(String invoiceFileUrl) {
        this.invoiceFileUrl = invoiceFileUrl;
    }

    public String getTaxFileUrl() {
        return taxFileUrl;
    }

    public void setTaxFileUrl(String taxFileUrl) {
        this.taxFileUrl = taxFileUrl;
    }

    public String getComplianceFileUrl() {
        return complianceFileUrl;
    }

    public void setComplianceFileUrl(String complianceFileUrl) {
        this.complianceFileUrl = complianceFileUrl;
    }

    public String getInvoiceStatus() {
        return invoiceStatus;
    }

    public void setInvoiceStatus(String invoiceStatus) {
        this.invoiceStatus = invoiceStatus;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public LocalDateTime getArchivedAt() {
        return archivedAt;
    }

    public void setArchivedAt(LocalDateTime archivedAt) {
        this.archivedAt = archivedAt;
    }

    public Long getArchivedBy() {
        return archivedBy;
    }

    public void setArchivedBy(Long archivedBy) {
        this.archivedBy = archivedBy;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(Integer delFlag) {
        this.delFlag = delFlag;
    }
}
