package cn.wisenergy.model.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @description:
 * @author: nh
 * @create: 2021-01-19 15:47
 **/
@Data
@ApiModel(value = "MonthlyWorkingHoursStatistics", description = "统计本月的填报信息")
public class MonthlyWorkingHoursStatistics implements Serializable ,Comparable{
    private static final long serialVersionUID = -8216457470821285624L;

    // 工单类型展示顺序，存储为类型id
    private final static Integer[] TYPE_ORDER = {1, 2, 5, 6, 7, 3, 4};

    /**
     * 工单类型
     */
    @ApiModelProperty(name = "projectType", value = "工单类型：商机/项目")
    private Integer projectType;

    /**
     * 工单类型名称
     */
    @ApiModelProperty(name = "typeName", value = "类型名称")
    private String typeName;

    /**
     * 已审批
     */
    @ApiModelProperty(name = "approved", value = "已审批条数")
    private Integer approved;

    /**
     * 填报次数
     */
    @ApiModelProperty(name = "count", value = "填报次数")
    private Integer count;

    /**
     * 填报工时
     */
    @ApiModelProperty(name = "workTime", value = "合计填报工时")
    private Integer workTime;

    @Override
    public int compareTo(Object o) {
        MonthlyWorkingHoursStatistics monthlyWorkingHoursStatistics = (MonthlyWorkingHoursStatistics) o;
        int thisI = 0;
        int oI = 0;
        for (int i = 0; i < TYPE_ORDER.length; i++) {
            if (projectType == TYPE_ORDER[i]) {
                thisI = i;
            }
            if (monthlyWorkingHoursStatistics.getProjectType() == TYPE_ORDER[i]) {
                oI = i;
            }
        }
        return thisI - oI;
    }
}
