package com.repair.model.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.repair.model.enumModel.eRecordStatu;
import com.repair.model.enumModel.eSchool;
import lombok.Data;

import java.util.Date;

/**
 * @Author: binguo
 * @Date: 2023/8/1 星期二 14:20
 * @Description: com.repair.model.vo
 * @Version: 1.0
 */
@Data
public class RepairRecordPageVo {
    /**
     * 数据ID
     */
    private int id;
    /**
     * 工单编号
     */
    private String recordNo;
    /**
     * 报修区域
     */
    private String areaName;
    /**
     * 用户ID
     */
    @JsonIgnore
    private int userId;
    /**
     * 姓名
     */
    private String userName;
    /**
     * 电话
     */
    private String userPhone;
    /**
     * 报修物品
     */
    private String articleName;
    /**
     * 故障描述
     */
    private String description;

    /**
     * 校区ID
     */
    private Integer schoolId;

    /**
     * 校区名称
     */
    private String school;

    public String getSchool() {
        return eSchool.stringOf(schoolId);
    }

    public void setSchool(String school) {
        this.school = school;
    }

    /**
     * 订单维修状态
     */
    @JsonIgnore
    private int maintenanceState;
    /**
     * 状态
     */
    private String state;
    /**
     * 报修时间
     */
    private Date reportTime;

    /**
     * 待接单师傅/接单师傅
     */
    @JsonIgnore
    private String rdrName;

    /**
     * 维修师傅
     */
    @JsonIgnore
    private String rdvName;

    /**
     * 维修师傅
     */
    @JsonIgnore
    private String rorName;

    /**
     * 维修师傅
     */
    private String maintenancerName;

    public String getMaintenancerName() {
        String name = maintenancerName;
        if(maintenanceState == eRecordStatu.Dispatch.getValue()){
            name = rdrName != null ? rdrName : maintenancerName;
        }else if(maintenanceState == eRecordStatu.Maintenance.getValue()){
            name = rdvName != null ? rdvName : maintenancerName;
        }else if(maintenanceState == eRecordStatu.OfflineReview.getValue()){
            name = rorName != null ? rorName : maintenancerName;
        }
        return name;
    }

    public void setMaintenancerName(String maintenancerName) {
        this.maintenancerName = maintenancerName;
    }

    /**
     * 出现派单按钮
     */
    private int dispatch;

    /**
     * 出现协作审核按钮
     */
    private int collaborate;

    /**
     * 出现转单审核按钮
     */
    private int transfer;

    /**
     * 出现转线下审核按钮
     */
    private int offline;

    /**
     * 出现关单按钮
     */
    private int close;

    /**
     * 出现改价按钮
     */
    private int changePrice;

    /**
     * 出现回复按钮
     */
    private int reply;

    /**
     * 出现延时按钮
     */
    private int delayed;
    /**
     * 出现详情按钮
     */
    private int details;
}
