package com.ruoyi.credit.dto;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.credit.annotation.EncryptedField;

/**
 * 服务周期员工分配DTO对象，包含员工原始薪资信息
 * 
 * @author ruoyi
 * @date 2025-12-26
 */
public class ServicePeriodEmployeeDTO
{
    /** 分配ID */
    private Long assignmentId;

    /** 服务周期ID */
    private Long servicePeriodId;

    /** 员工ID */
    private Long employeeId;

    /** 员工姓名(加密) */
    @EncryptedField(algorithm = "AES-256-GCM")
    private String employeeName;

    /** 员工工号 */
    private String employeeNumber;

    /** 分配岗位 */
    private String assignedPosition;

    /** 工作天数 */
    private Integer workDays;

    /** 分配薪资(加密) - 转换后的日薪 */
    @EncryptedField(algorithm = "AES-256-GCM")
    private BigDecimal assignedSalary;

    /** 总成本(加密) */
    @EncryptedField(algorithm = "AES-256-GCM")
    private BigDecimal totalCost;

    /** 分配状态 */
    private String assignmentStatus;

    /** 分配日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date assignmentDate;

    /** 分配人 */
    private String assignedBy;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    // 员工原始薪资信息
    /** 薪资单位 */
    private String salaryUnit;

    /** 小时薪资(加密) */
    @EncryptedField(algorithm = "AES-256-GCM")
    private BigDecimal hourlySalary;

    /** 日薪标准(加密) */
    @EncryptedField(algorithm = "AES-256-GCM")
    private BigDecimal dailySalary;

    /** 月薪标准(加密) */
    @EncryptedField(algorithm = "AES-256-GCM")
    private BigDecimal monthlySalary;

    /** 员工状态 */
    private String employeeStatus;

    // Getters and Setters
    public Long getAssignmentId() {
        return assignmentId;
    }

    public void setAssignmentId(Long assignmentId) {
        this.assignmentId = assignmentId;
    }

    public Long getServicePeriodId() {
        return servicePeriodId;
    }

    public void setServicePeriodId(Long servicePeriodId) {
        this.servicePeriodId = servicePeriodId;
    }

    public Long getEmployeeId() {
        return employeeId;
    }

    public void setEmployeeId(Long employeeId) {
        this.employeeId = employeeId;
    }

    public String getEmployeeName() {
        return employeeName;
    }

    public void setEmployeeName(String employeeName) {
        this.employeeName = employeeName;
    }

    public String getEmployeeNumber() {
        return employeeNumber;
    }

    public void setEmployeeNumber(String employeeNumber) {
        this.employeeNumber = employeeNumber;
    }

    public String getAssignedPosition() {
        return assignedPosition;
    }

    public void setAssignedPosition(String assignedPosition) {
        this.assignedPosition = assignedPosition;
    }

    public Integer getWorkDays() {
        return workDays;
    }

    public void setWorkDays(Integer workDays) {
        this.workDays = workDays;
    }

    public BigDecimal getAssignedSalary() {
        return assignedSalary;
    }

    public void setAssignedSalary(BigDecimal assignedSalary) {
        this.assignedSalary = assignedSalary;
    }

    public BigDecimal getTotalCost() {
        return totalCost;
    }

    public void setTotalCost(BigDecimal totalCost) {
        this.totalCost = totalCost;
    }

    public String getAssignmentStatus() {
        return assignmentStatus;
    }

    public void setAssignmentStatus(String assignmentStatus) {
        this.assignmentStatus = assignmentStatus;
    }

    public Date getAssignmentDate() {
        return assignmentDate;
    }

    public void setAssignmentDate(Date assignmentDate) {
        this.assignmentDate = assignmentDate;
    }

    public String getAssignedBy() {
        return assignedBy;
    }

    public void setAssignedBy(String assignedBy) {
        this.assignedBy = assignedBy;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getSalaryUnit() {
        return salaryUnit;
    }

    public void setSalaryUnit(String salaryUnit) {
        this.salaryUnit = salaryUnit;
    }

    public BigDecimal getHourlySalary() {
        return hourlySalary;
    }

    public void setHourlySalary(BigDecimal hourlySalary) {
        this.hourlySalary = hourlySalary;
    }

    public BigDecimal getDailySalary() {
        return dailySalary;
    }

    public void setDailySalary(BigDecimal dailySalary) {
        this.dailySalary = dailySalary;
    }

    public BigDecimal getMonthlySalary() {
        return monthlySalary;
    }

    public void setMonthlySalary(BigDecimal monthlySalary) {
        this.monthlySalary = monthlySalary;
    }

    public String getEmployeeStatus() {
        return employeeStatus;
    }

    public void setEmployeeStatus(String employeeStatus) {
        this.employeeStatus = employeeStatus;
    }

    /**
     * 获取原始薪资（根据薪资单位）
     */
    public BigDecimal getOriginalSalary() {
        if (salaryUnit == null) {
            return BigDecimal.ZERO;
        }
        
        switch (salaryUnit) {
            case "HOURLY":
                return hourlySalary != null ? hourlySalary : BigDecimal.ZERO;
            case "DAILY":
                return dailySalary != null ? dailySalary : BigDecimal.ZERO;
            case "MONTHLY":
                return monthlySalary != null ? monthlySalary : BigDecimal.ZERO;
            default:
                return BigDecimal.ZERO;
        }
    }

    /**
     * 获取薪资单位显示文本
     */
    public String getSalaryUnitDisplay() {
        if (salaryUnit == null) {
            return "";
        }
        
        switch (salaryUnit) {
            case "HOURLY":
                return "元/小时";
            case "DAILY":
                return "元/天";
            case "MONTHLY":
                return "元/月";
            default:
                return "";
        }
    }
}