package com.emergency.avenue.storage.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@Data
@Schema(description = "物资维护表")
@TableName(autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
public class MaterialMaintenance extends Model<MaterialMaintenance> {


	@TableId(type = IdType.AUTO)
	@Schema(description = "记录的唯一标识符")
	private Integer id;

	@Schema(description = "物资大类")
	private String materialGroup;

	@Schema(description = "物资类别")
	private String materialType;


	@Schema(description = "物资名称")
	private String materialName;


	@Schema(description = "物资单位")
	private String materialUnit;


	@Schema(description = "入库日期")
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date entryDate;

	@Schema(description = "单价")
	private BigDecimal unitPrice;


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

	@Schema(description = "状态")
	private String status;

	/**
	 * 用户id
	 */
	@Schema(description = "用户id")
	private String userId;

	/**
	 * 部门id
	 */
	@Schema(description = "部门id")
	private String deptId;

	/**
	 * 提交时间
	 */
	@Schema(description = "提交时间")
	private LocalDateTime submitTime;

	@TableField(exist = false)
	@Schema(description = "物资名称（用于查询与回显）")
	private String materialNameVo;
	@TableField(exist = false)
	@Schema(description = "物资大类（用于查询与回显）")
	private String materialGroupVo;
	@TableField(exist = false)
	@Schema(description = "物资类别（用于查询与回显）")
	private String materialTypeVo;
	@TableField(exist = false)
	@Schema(description = "物资单位（用于查询与回显）")
	private String materialUnitVo;

	@TableField(exist = false)
	@Schema(description = "维护明细数据")
	private List<MaterialMaintenanceDetail> materialMaintenanceDetails;

	@TableField(exist = false)
	@Schema(description = "维护审核状态")
	private List<MaterialMaintenanceStatus> materialMaintenanceStatuses;

	@TableField(exist = false)
	@Schema(description = "开始入库日期")
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date startEntryDate;

	@TableField(exist = false)
	@Schema(description = "结束入库日期")
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date endEntryDate;

	@Schema(description = "物资树")
	@TableField(typeHandler = JacksonTypeHandler.class)
	private List<String> materialTree;
	@Schema(description = "文件list")
	@TableField(typeHandler = JacksonTypeHandler.class)
	private List<String> filePartList;
	@TableField(exist = false)
	@Schema(description = "库点简称")
	private String warehouse;
}
