package com.ruoyi.web.sales.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.web.base.domain.base.Base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sales_price")
@ApiModel(value = "SalesPrice对象", description = "销售价格主表")
public class SalesPrice extends Base {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "价格单编号")
    @Excel(name = "价格单编号")
    private String priceNum;

    @ApiModelProperty(value = "价格类型（编码，对应 base_price_type.price_type_num）")
    @Excel(name = "价格类型编码")
    private String priceType;

    @TableField(exist = false)
    @ApiModelProperty(value = "价格类型名称（自 base_price_type 带出，不落库）")
    @Excel(name = "价格类型名称")
    private String priceTypeName;

    @ApiModelProperty(value = "执行日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "执行日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date effectiveDate;

    @ApiModelProperty(value = "失效日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "失效日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date expireDate;

    @TableField(exist = false)
    @ApiModelProperty(value = "明细清单")
    private List<SalesPriceItem> items;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "执行日期开始")
    private Date effectiveDateStart;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "执行日期结束")
    private Date effectiveDateEnd;
}
