package com.trade.service.trade.salesorder.dto;

import java.math.BigDecimal;
import java.time.LocalDate;

import com.trade.service.finance.paymentcollection.domain.OrderReceivePaymentAssociation;
import io.swagger.annotations.ApiModel;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.trade.service.filestorage.dto.FileAbstractDto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @description:
 * @Author: wanglang
 * @Date: 2024/11/6
 * @Version: 1.0
 */
@Data
@ApiModel(description = "收款相关订单列表信息")
public class OrderListInfoDto {

    // 订单表主键
    @ApiModelProperty(name = "id", value = "订单表主键")
    private Long id;
    @ApiModelProperty(name = "fileId", value = "文件id(提交时传这个字段)")
    private Long fileId;
    @ApiModelProperty(name = "orderNo", value = "订单id/订单编号")
    private String orderNo;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(name = "expectedPaymentDueDate", value = "预计货款日期")
    private LocalDate expectedPaymentDueDate;
    @ApiModelProperty(name = "supplementaryAgreementDocument", value = "补充协议文件/展示时用这个字段")
    private FileAbstractDto supplementaryAgreementDocument;
    @ApiModelProperty(name = "currency", value = "币种")
    private String currency = "USD";
    /**
     * 订单金额
     */
    @ApiModelProperty(name = "amount", value = "商品总金额")
    private BigDecimal amount;
    @ApiModelProperty(name = "actualAmount", value = "实际收款金额")
    private BigDecimal actualAmount;
    @ApiModelProperty(name = "goodsName", value = "商品名称（仅用于B端入账详情展示）")
    private String goodsName;
    @ApiModelProperty(name = "remark", value = "备注")
    private String remark;

    public OrderListInfoDto(){
    }

    public OrderListInfoDto(OrderReceivePaymentAssociation orderReceivePaymentAssociation){
        this.id = orderReceivePaymentAssociation.getOrderId();
        this.fileId = orderReceivePaymentAssociation.getFileId();
        this.orderNo = orderReceivePaymentAssociation.getOrderNo();
        this.currency = orderReceivePaymentAssociation.getGoodsCurrency();
        this.amount = orderReceivePaymentAssociation.getGoodsAmount();
        this.actualAmount = orderReceivePaymentAssociation.getActualReceivedAmount();
        this.remark = orderReceivePaymentAssociation.getRemark();
    }
}
