package com.zt.plat.module.qms.business.bus.controller.vo;

import java.time.LocalDateTime;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

@Data
public class BusinessSampleEntrustDetailExtendRespVO extends BusinessSampleEntrustDetailRespVO {

	/**
	 * 委托单号
	 */
    private String entrustNumber;

    /**
     * 委托单位
     */
    private String entrustUnit;
    
    /**
     * 委托扩展信息
     */
    private String externalInfomation;
    
    /**
     * 样品类别： 装港样/卸港样
     */
    private String sampleCategory;
    
    public String getSampleCategory() {
    	this.sampleCategory = null;
    	if (StringUtils.isNotBlank(this.externalInfomation)) {
    		JSONObject extInfJsonObject = JSON.parseObject(this.externalInfomation);
    		this.sampleCategory = extInfJsonObject.getString("sampleCategory");
		}
    	return this.sampleCategory;
    }
    
	/**
	 * 样品类型key
	 */
    private String sampleTypeDictionaryBusinessKey;
	
	/** 样品大类名称 **/
	private String baseSampleName;

	/** 主样配置id **/
    private Long configBaseSampleId;
    
	/** 打印标签 **/
    private String printTemplate;
    
    @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化（响应）
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "创建时间(yyyy-MM-dd HH:mm:ss)")
    private LocalDateTime createTime;
    
	private List<BusinessSampleEntrustProjectExtendRespVO> sampleEntrustDetailProjectList;

}
