package com.sundot.airport.attendance.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sundot.airport.common.annotation.Excel;
import com.sundot.airport.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 考勤记录对象 attendance_record
 *
 * @author wangchong
 * @date 2025-07-10
 */
@Data
public class AttendanceRecord extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 租户号
     */
    private String tenantId;

    /**
     * 乐观锁
     */
    private Long revision;

    /**
     * 主键
     */
    private Long id;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 签到时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "签到时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 5)
    private Date checkInTime;

    /**
     * 签退时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "签退时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 6)
    private Date checkOutTime;

    /**
     * 工作时长(分钟)
     */
    @Excel(name = "工作时长(分钟)", sort = 7)
    private Long workDuration;

    /**
     * 考勤状态
     */
    private String status;

    /**
     * 班组编码
     */
    private String teamCode;

    /**
     * 班组名称
     */
    @Excel(name = "班组名称", sort = 3)
    private String teamName;

    /**
     * 科室编码
     */
    private String departmentCode;

    /**
     * 科室名称
     */
    @Excel(name = "科室名称", sort = 2)
    private String departmentName;

    /**
     * 大队编码
     */
    private String brigadeCode;

    /**
     * 大队名称
     */
    @Excel(name = "大队名称", sort = 9)
    private String brigadeName;

    /**
     * 机构站编码
     */
    private String stationCode;

    /**
     * 机构站名称
     */
    private String stationName;

    /**
     * 用户名称
     */
    @Excel(name = "用户姓名", sort = 1)
    private String userName;

    /**
     * 备注
     */
    @Excel(name = "备注", sort = 8)
    private String remark;

    /**
     * 考勤日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "考勤日期", width = 30, dateFormat = "yyyy-MM-dd", sort = 4)
    private Date attendanceDate;

    /**
     * 加班时长(分钟)
     */
    private Long overDuration;

    /**
     * 考勤状态名称
     */
    private String statusDesc;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("tenantId", getTenantId())
                .append("revision", getRevision())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("id", getId())
                .append("userId", getUserId())
                .append("checkInTime", getCheckInTime())
                .append("checkOutTime", getCheckOutTime())
                .append("workDuration", getWorkDuration())
                .append("status", getStatus())
                .append("teamCode", getTeamCode())
                .append("teamName", getTeamName())
                .append("departmentCode", getDepartmentCode())
                .append("departmentName", getDepartmentName())
                .append("brigadeCode", getBrigadeCode())
                .append("brigadeName", getBrigadeName())
                .append("stationCode", getStationCode())
                .append("stationName", getStationName())
                .append("userName", getUserName())
                .append("remark", getRemark())
                .append("attendanceDate", getAttendanceDate())
                .append("overDuration", getOverDuration())
                .append("statusDesc", getStatusDesc())
                .toString();
    }

    /**
     * 考勤日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date attendanceDateStart;

    /**
     * 考勤日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date attendanceDateEnd;
}
