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;

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

@TableName("Z_WORK_SHIFT")

public class WorkShift extends Model<WorkShift> {

    private static final String WORK_SHIFT_BO_FORMAT = "WorkShiftBO:{0},{1},{2}";

    private static final long serialVersionUID = 1L;

    /**
     * 唯一标识
     */
    @TableId(value = "HANDLE", type = IdType.INPUT)
    private String handle;
    /**
     * 站点
     */
    @TableField("SITE")
    private String site;
    /**
     * 关联工作时段类型
     */
    @TableField("PRODUCTION_DAY_TYPE_BO")
    private String productionDayTypeBo;
    /**
     * 描述
     */
    @TableField("DESCRIPTION")
    private String description;
    /**
     * 班次（工作时段）
     */
    @TableField("PRODUCTION_SHIFT")
    private String productionShift;
    /**
     * 开始时间
     */
    @TableField("START_TIME")
    private String startTime;
    /**
     * 结束时间
     */
    @TableField("END_TIME")
    private String endTime;
    /**
     * 是否启用
     */
    @TableField("ENABLED")
    private String enabled;
    /**
     * 创建日期
     */
    @TableField("CREATED_DATE_TIME")
    private Date createdDateTime;
    /**
     * 更新日期
     */
    @TableField("MODIFIED_DATE_TIME")
    private Date modifiedDateTime;
    /**
     * 创建人
     */
    @TableField("CREATOR")
    private String creator;
    /**
     * 更新人
     */
    @TableField("UPDATER")
    private String updater;


    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 getProductionDayTypeBo() {
        return productionDayTypeBo;
    }

    public void setProductionDayTypeBo(String productionDayTypeBo) {
        this.productionDayTypeBo = productionDayTypeBo;
    }

    public String getDescription() {
        return description;
    }

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

    public String getProductionShift() {
        return productionShift;
    }

    public void setProductionShift(String productionShift) {
        this.productionShift = productionShift;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public String getEnabled() {
        return enabled;
    }

    public void setEnabled(String enabled) {
        this.enabled = enabled;
    }

    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;
    }

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

    public static String genHandle(String site, String productionDayType, String startTime) {
        startTime = startTime.replace(":", "");
        return MessageFormat.format(WORK_SHIFT_BO_FORMAT, site, productionDayType, startTime);
    }

    @Override
    public String toString() {
        return "WorkShift{" +
                "handle = " + handle +
                ", site = " + site +
                ", productionDayTypeBo = " + productionDayTypeBo +
                ", description = " + description +
                ", productionShift = " + productionShift +
                ", startTime = " + startTime +
                ", endTime = " + endTime +
                ", enabled = " + enabled +
                ", createdDateTime = " + createdDateTime +
                ", modifiedDateTime = " + modifiedDateTime +
                ", creator = " + creator +
                ", updater = " + updater +
                "}";
    }
}