package com.trade.client.trade.exportrebate.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.trade.service.trade.exportrebate.domain.TaxRebatePurchaseDetails;
import com.trade.service.trade.exportrebate.dto.TaxRebatePurchaseAbstractInfo;
import lombok.Getter;
import lombok.Setter;

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

@Getter
@Setter
public class PurchaseDetailDto {

    /**
     * 采购订单号
     */
    private String purchaseOrderNo;
    /**
     * 凭证种类名称（发票类型）
     */
    private String voucherTypeName;
    /**
     * 进货凭证号（发票号码）
     */
    private String purchaseVoucherNo;
    /**
     * 开票日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date invoiceDate;
    /**
     * 商品HS编码
     */
    private String hsCode;
    /**
     * 商品名称
     */
    private String exportCommodityName;
    /**
     * 计量单位
     */
    private String measurementUnit;
    /**
     * 数量
     */
    private BigDecimal exportQuantity;
    /**
     * 计税金额
     */
    private BigDecimal taxBaseAmount;
    /**
     * 征税率（百分制，即已乘100）
     */
    private BigDecimal addedTaxRate;
    /**
     * 退税率（百分制，即已乘100）
     */
    private BigDecimal exportTaxRebateRate;
    /**
     * 可退税额
     */
    private BigDecimal taxRefundableAmount;

    public PurchaseDetailDto(TaxRebatePurchaseAbstractInfo purchaseDetails){
        this.purchaseOrderNo = purchaseDetails.getPurchaseOrderNo();
        this.voucherTypeName = purchaseDetails.getVoucherTypeName();
        this.purchaseVoucherNo = purchaseDetails.getPurchaseVoucherNo();
        this.invoiceDate = purchaseDetails.getInvoiceDate();
        this.hsCode = purchaseDetails.getHsCode();
        this.exportCommodityName = purchaseDetails.getExportCommodityName();
        this.measurementUnit = purchaseDetails.getMeasurementUnit();
        this.exportQuantity = purchaseDetails.getExportQuantity();
        this.taxBaseAmount = purchaseDetails.getTaxBaseAmount();
        this.addedTaxRate = purchaseDetails.getAddedTaxRate();
        this.exportTaxRebateRate = purchaseDetails.getExportTaxRebateRate();
        this.taxRefundableAmount = purchaseDetails.getTaxRefundableAmount();
    }
}
