package com.tofly.ghrq_route.module.trouble.domain;

import com.google.gson.annotations.SerializedName;
import com.tofly.ghrq_route.module.uploadFile.domain.UploadFileBean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Amu on 2017/7/14.
 */

@SuppressWarnings("serial")
public class TroublePlanRecordBean implements Serializable {
    /**
     * create_time : null
     * create_username :
     * notes : 巡检录入2 2017-7-14
     * "pic": [
     {
     "filename": "Upload/2017-07/e5b938bb-6040-4f69-8dec-054423a41ee5.png",
     "filenote": "巡检图片",
     "upload_time": "2017-07-14 11:13:04",
     "upload_username": "cr"
     }
     ],
     "audio": [
     {
     "filename": "Upload/2017-07/60793a41-0424-4774-bb74-f0148b04019f.mp3",
     "filenote": "巡检音频",
     "upload_time": "2017-07-14 11:13:05",
     "upload_username": "cr",
     "audiolength": "3"
     }
     ]
     */

    private static final int CHECK_STATE_UNDONE = 0;
    private static final int CHECK_STATE_PASSED = 1;
    private static final int CHECK_STATE_UPPASSED = 2;

    public static final String TROUBLE_RECORD_BEAN_KEY = "trouble_record_bean";
    public static final String TROUBLE_RECORD_CLOSE_KEY = "trouble_record_close";
    public static final String TROUBLE_RECORD_EDITABLE_KEY = "trouble_record_is_editable";

    @SerializedName(value = "create_time",alternate = {"handle_after_time"})
    private String create_time;
    @SerializedName(value = "create_username",alternate = {"handle_after_username"})
    private String create_username;
    @SerializedName(value = "notes",alternate = {"handle_after_notes"})
    private String notes;
    private String check_time;
    private String check_user;
    private int check_state;    //0:待审核 1:已通过 2.未通过
    private List<UploadFileBean> pic;
    private List<UploadFileBean> audio;
    private String id;
    private int status;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCreate_time() {
        return create_time;
    }

    public void setCreate_time(String create_time) {
        this.create_time = create_time;
    }

    public String getCreate_username() {
        return create_username;
    }

    public void setCreate_username(String create_username) {
        this.create_username = create_username;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public String getCheck_time() {
        return check_time;
    }

    public void setCheck_time(String check_time) {
        this.check_time = check_time;
    }

    public String getCheck_user() {
        return check_user;
    }

    public void setCheck_user(String check_user) {
        this.check_user = check_user;
    }

    public int getCheck_state() {
        return check_state;
    }

    public void setCheck_state(int check_state) {
        this.check_state = check_state;
    }

    public List<UploadFileBean> getPic() {
        return pic;
    }

    public void setPic(List<UploadFileBean> pic) {
        this.pic = pic;
    }

    public List<UploadFileBean> getAudio() {
        return audio;
    }

    public void setAudio(List<UploadFileBean> audio) {
        this.audio = audio;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public static TroublePlanRecordBean getRecordFromLocal(LocalPlanRecordBean localRecord){
        TroublePlanRecordBean planRecordBean = new TroublePlanRecordBean();
        planRecordBean.setId(localRecord.getId());
        planRecordBean.setCreate_username(localRecord.getCreate_username());
        planRecordBean.setCreate_time(localRecord.getCreate_time());
        planRecordBean.setNotes(localRecord.getNotes());
        planRecordBean.setStatus(localRecord.getStatus());
        return planRecordBean;
    }

    public static List<TroublePlanRecordBean> getRecordsFromLocal(List<LocalPlanRecordBean> localRecords){
        List<TroublePlanRecordBean> planRecordBeans = new ArrayList<>();
        if (localRecords != null && localRecords.size() > 0){
            for (LocalPlanRecordBean localRecord : localRecords){
                TroublePlanRecordBean recordBean = getRecordFromLocal(localRecord);
                planRecordBeans.add(recordBean);
            }
        }
        return planRecordBeans;
    }
}
