package com.repair.model.vo;

import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.repair.model.enumModel.eRecordStatu;
import lombok.Data;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

@Data
public class TrackDetailsVo {
    /**
     * 数据ID
     */
    private int id;

    /**
     * 维修单状态ID
     */
    private Integer maintenanceState;

    /**
     * 维修状态
     */
    private String state;

    public String getState() {

        switch (maintenanceState) {
            case 3:
                state = "转后勤";
                break;
            case 4:
                state = content.contains("回复") ? "回复" : "待确认";
                break;
            case 9:
                state = "已关单";
                break;
            default:
                String[] str = content.split("-");
                if(str.length > 1){
                    state =str[0];
                }else{
                    state = content;
                }

                break;
        }

        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    /**
     * 跟踪内容
     */
    private String content;

    /**
     * 跟踪时间
     */
    private Date createTime;

    /**
     * 名称
     */
    private String userName;

    /**
     * 身份
     */
    private String userZzstr;

    /**
     * 照片
     */
    @JsonIgnore
    private String image;

    /**
     * 照片集合
     */
    private List<String> images;

    public List<String> getImages() {
        return ObjectUtils.isEmpty(image) ? images : Arrays.asList(image.split(","));
    }

    public void setImages(List<String> images) {
        this.images = images;
    }

    /**
     * 录音
     */
    private String voice;

    /**
     * 录音时长
     */
    private Integer voiceLength;
}
