package com.xunmei.system.api.domain;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.xunmei.common.core.utils.Ymd;
import lombok.Builder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.xunmei.common.core.web.domain.BaseEntity;

import javax.validation.constraints.NotNull;

/**
 * 【请填写功能名称】对象 sys_work_time
 *
 * @author xunmei
 * @date 2023-08-14
 */
@Data
@EqualsAndHashCode(callSuper = false)
//@Builder
@Accessors(chain = true)
@TableName("sys_work_time")
@ApiModel(value = "SysWorkTime对象", description = "【请填写功能名称】")
public class SysWorkTime extends BaseEntity {
    private static final long serialVersionUID = 1L;

    public SysWorkTime() {
    }

    @ApiModelProperty(value = "日期")
    @TableField(exist = false)
    private Date[] range;

//    public static SysWorkTime of(final Long orgId, final Date date) {
//        final Ymd ymd = Ymd.of(date);
//        return SysWorkTime.builder()
//                .id(IDHelper.date(date, orgId))
//                .orgId(orgId)
//                .ymd(ymd)
//                .workTimeMonthId(IDHelper.month(date, orgId))
//                .isError(0L)
//                .build();
//    }

    /**
     * $column.columnComment
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private String id;


    @TableField(exist = false)
    private String orgName;
    /**
     * 最后修改人id
     */
    @ApiModelProperty(value = "最后修改人id")
    private Long modifiedId;

    @ApiModelProperty("年月日")
    @TableField(exist = false)
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date date;
    /**
     * 修改人名称
     */
    @ApiModelProperty(value = "修改人名称")
    private String modifiedName;

    /**
     * 营业终了
     */
    @ApiModelProperty(value = "营业终了")
    private String closeTime;

    @ApiModelProperty(value = "月份")
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date month;
    
    @TableField(exist = false)
    private String monthStr;
    /**
     * 是否营业
     */
    @ApiModelProperty(value = "是否营业")
    private Long isEnable;
    /**
     * 年月日
     */
    @TableField(exist = false)
    private Ymd ymd;
    /**
     * 营业时间
     */
    @ApiModelProperty(value = "营业时间")
    private String openTime;

    /**
     * 午休开始
     */
    @ApiModelProperty(value = "午休开始")
    private String noonbreakStart;

    /**
     * 午休结束
     */
    @ApiModelProperty(value = "午休结束")
    private String noonbreakEnd;

    /**
     * 机构
     */
    @ApiModelProperty(value = "机构")
    private Long orgId;

    /**
     * 下班时间
     */
    @ApiModelProperty(value = "下班时间")
    private String workOffTime;

    /**
     * 上班时间
     */
    @ApiModelProperty(value = "上班时间")
    private String workTime;

    /**
     * 作息月
     */
    @ApiModelProperty(value = "作息月")
    private String workTimeMonthId;

    /**
     * 年月日
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "年月日")
    private Date ymdDate;

    /**
     * 日
     */
    @ApiModelProperty(value = "日")
    private Long ymdDay;

    /**
     * 月
     */
    @ApiModelProperty(value = "月")
    private Long ymdMonth;

    /**
     * 季
     */
    @ApiModelProperty(value = "季")
    private Long ymdQuarter;

    /**
     * 周
     */
    @ApiModelProperty(value = "周")
    private Long ymdWeek;

    /**
     * 年
     */
    @ApiModelProperty(value = "年")
    private Long ymdYear;

    /**
     * 半年
     */
    @ApiModelProperty(value = "半年")
    private Long ymdHalfyear;

    /**
     * 是否异常
     */
    @ApiModelProperty(value = "是否异常")
    private Long isError;

    /**
     * 下班打卡时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "下班打卡时间")
    private Date offDutyTime;

    /**
     * 上班打卡时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "上班打卡时间")
    private Date onDutyTime;

    /**
     * 小时
     */
    @ApiModelProperty(value = "小时")
    private Long ymdHour;

    /**
     * 分钟
     */
    @ApiModelProperty(value = "分钟")
    private Long ymdMinute;

    /**
     * 是否手动配置1是0否
     */
    @ApiModelProperty(value = "是否手动配置1是0否")
    private Long isManual;


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)


                .append("id", getId())


                .append("createTime", getCreateTime())


                .append("modifiedId", getModifiedId())


                .append("modifiedName", getModifiedName())


                .append("updateTime", getUpdateTime())


                .append("closeTime", getCloseTime())


                .append("isEnable", getIsEnable())


                .append("openTime", getOpenTime())


                .append("noonbreakStart", getNoonbreakStart())


                .append("noonbreakEnd", getNoonbreakEnd())


                .append("orgId", getOrgId())


                .append("workOffTime", getWorkOffTime())


                .append("workTime", getWorkTime())


                .append("workTimeMonthId", getWorkTimeMonthId())


                .append("ymdDate", getYmdDate())


                .append("ymdDay", getYmdDay())


                .append("ymdMonth", getYmdMonth())


                .append("ymdQuarter", getYmdQuarter())


                .append("ymdWeek", getYmdWeek())


                .append("ymdYear", getYmdYear())


                .append("ymdHalfyear", getYmdHalfyear())


                .append("isError", getIsError())


                .append("offDutyTime", getOffDutyTime())


                .append("onDutyTime", getOnDutyTime())


                .append("ymdHour", getYmdHour())


                .append("ymdMinute", getYmdMinute())


                .append("isManual", getIsManual())
                .toString();
    }
}
