package com.foreverwin.mesnac.dispatch.model;

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 java.io.Serializable;
import java.text.MessageFormat;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author syngna
 * @since 2020-08-18
 */

@TableName("Z_PRODUCTION_DAY_TYPE")

public class ProductionDayType extends Model<ProductionDayType> {

    private static final String PRODUCTION_DAY_TYPE_BO_FORMAT = "ProductionDayTypeBO:{0},{1}";

    private static final long serialVersionUID = 1L;

    /**
     * 唯一标识
     */
    @TableId(value = "HANDLE", type = IdType.INPUT)
    private String handle;
    /**
     * 站点
     */
    @TableField("SITE")
    private String site;
    /**
     * 工作时段类型
     */
    @TableField("PRODUCTION_DAY_TYPE")
    private String productionDayType;
    /**
     * 描述
     */
    @TableField("DESCRIPTION")
    private String description;
    /**
     * 颜色样式
     */
    @TableField("COLOR")
    private String color;
    /**
     * 创建日期
     */
    @TableField("CREATED_DATE_TIME")
    private Date createdDateTime;
    /**
     * 更新日期
     */
    @TableField("MODIFIED_DATE_TIME")
    private Date modifiedDateTime;
    /**
     * 创建人
     */
    @TableField("CREATOR")
    private String creator;
    /**
     * 更新人
     */
    @TableField("UPDATER")
    private String updater;

    @TableField(exist = false)
    private List<WorkShift> workShiftList;

    public ProductionDayType() {

    }

    public ProductionDayType(String site, String productionDayType) {
        this.site = site;
        this.productionDayType = productionDayType;
    }

    public String getHandle() {
        return handle;
    }

    public void setHandle(String handle) {
        this.handle = handle;
    }

    public String getSite() {
        return site;
    }

    public void setSite(String site) {
        this.site = site;
    }

    public String getProductionDayType() {
        return productionDayType;
    }

    public void setProductionDayType(String productionDayType) {
        this.productionDayType = productionDayType;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Date getCreatedDateTime() {
        return createdDateTime;
    }

    public void setCreatedDateTime(Date createdDateTime) {
        this.createdDateTime = createdDateTime;
    }

    public Date getModifiedDateTime() {
        return modifiedDateTime;
    }

    public void setModifiedDateTime(Date modifiedDateTime) {
        this.modifiedDateTime = modifiedDateTime;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public String getUpdater() {
        return updater;
    }

    public void setUpdater(String updater) {
        this.updater = updater;
    }

    public List<WorkShift> getWorkShiftList() {
        return workShiftList;
    }

    public void setWorkShiftList(List<WorkShift> workShiftList) {
        this.workShiftList = workShiftList;
    }

    @Override
    protected Serializable pkVal() {
        return this.handle;
    }

    @Override
    public String toString() {
        return "ProductionDayType{" +
                "handle = " + handle +
                ", site = " + site +
                ", productionDayType = " + productionDayType +
                ", description = " + description +
                ", color = " + color +
                ", createdDateTime = " + createdDateTime +
                ", modifiedDateTime = " + modifiedDateTime +
                ", creator = " + creator +
                ", updater = " + updater +
                "}";
    }

    public static String genHandle(String site, String productionDayType) {
        return MessageFormat.format(PRODUCTION_DAY_TYPE_BO_FORMAT, site, productionDayType);
    }
}