package com.huimv.employment.service.order.dto;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;

import java.math.BigDecimal;

/**
 * 开票归档办结请求：保存开票信息并结束流程。
 */
@Schema(description = "开票归档办结请求（含开票信息落库）")
public class OrderCompleteRequest {

    @JsonProperty("tax_cleared")
    @JsonAlias({"taxCleared"})
    @Schema(description = "是否已完税；默认 true（MVP Mock）")
    private Boolean taxCleared;

    @JsonProperty("invoice_issued")
    @JsonAlias({"invoiceIssued"})
    @Schema(description = "是否已开票；默认 true（MVP Mock）")
    private Boolean invoiceIssued;

    @JsonProperty("invoice_type")
    @JsonAlias({"invoiceType"})
    @Schema(description = "发票类型：vat_special / vat_normal；默认 vat_special", example = "vat_special")
    private String invoiceType;

    @JsonProperty("tax_rate")
    @JsonAlias({"taxRate"})
    @Schema(description = "税率，默认 0.06", example = "0.06")
    private BigDecimal taxRate;

    @JsonProperty("invoice_amount")
    @JsonAlias({"invoiceAmount"})
    @Schema(description = "开票金额不含税；不传则取结算单预计开票额")
    private BigDecimal invoiceAmount;

    @JsonProperty("tax_amount")
    @JsonAlias({"taxAmount"})
    @Schema(description = "税额；不传则按 开票金额×税率 计算")
    private BigDecimal taxAmount;

    @JsonProperty("total_with_tax")
    @JsonAlias({"totalWithTax"})
    @Schema(description = "价税合计；不传则 开票金额+税额")
    private BigDecimal totalWithTax;

    @JsonProperty("company_name")
    @JsonAlias({"companyName", "invoice_title", "invoiceTitle"})
    @Schema(description = "开票抬头-企业名称；不传则取企业全称")
    private String companyName;

    @JsonProperty("credit_code")
    @JsonAlias({"creditCode", "tax_no", "taxNo"})
    @Schema(description = "统一社会信用代码；不传则取企业 credit_code")
    private String creditCode;

    @JsonProperty("bank_account_info")
    @JsonAlias({"bankAccountInfo", "bank_account", "bankAccount"})
    @Schema(description = "开户银行及账号")
    private String bankAccountInfo;

    @JsonProperty("invoice_no")
    @JsonAlias({"invoiceNo"})
    @Schema(description = "发票号码（可选）", example = "INV20260728001")
    private String invoiceNo;

    @JsonProperty("tax_voucher_no")
    @JsonAlias({"taxVoucherNo"})
    @Schema(description = "完税凭证号（可选）", example = "TAX20260728001")
    private String taxVoucherNo;

    @Schema(description = "备注")
    private String remark;

    public Boolean getTaxCleared() {
        return taxCleared;
    }

    public void setTaxCleared(Boolean taxCleared) {
        this.taxCleared = taxCleared;
    }

    public boolean isTaxClearedOrDefault() {
        return taxCleared == null || Boolean.TRUE.equals(taxCleared);
    }

    public Boolean getInvoiceIssued() {
        return invoiceIssued;
    }

    public void setInvoiceIssued(Boolean invoiceIssued) {
        this.invoiceIssued = invoiceIssued;
    }

    public boolean isInvoiceIssuedOrDefault() {
        return invoiceIssued == null || Boolean.TRUE.equals(invoiceIssued);
    }

    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 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 getRemark() {
        return remark;
    }

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