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

import com.tofly.ghrq_route.module.plan.domain.OfflinePathBean;
import com.tofly.ghrq_route.common.util.date.DateUtils;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.NotNull;
import org.greenrobot.greendao.annotation.Unique;

import java.io.Serializable;
import java.util.UUID;

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

@Entity(nameInDb = "DB_LOCAL_PLAN_RECORD")
@SuppressWarnings("serial")
public class LocalPlanRecordBean 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"
     }
     ]
     */
    @Id @NotNull @Unique
    private String id;
    private String create_time;
    private String create_username;
    private String notes;
    private String plan_Point_id;
    private String point_id;
    private String child_plan_id;
    private String plan_id;
    private String trouble_id;
    private String lat;
    private String lng;
    private int status;

    @Generated(hash = 402767237)
    public LocalPlanRecordBean(@NotNull String id, String create_time,
                               String create_username, String notes, String plan_Point_id,
                               String point_id, String child_plan_id, String plan_id,
                               String trouble_id, String lat, String lng, int status) {
        this.id = id;
        this.create_time = create_time;
        this.create_username = create_username;
        this.notes = notes;
        this.plan_Point_id = plan_Point_id;
        this.point_id = point_id;
        this.child_plan_id = child_plan_id;
        this.plan_id = plan_id;
        this.trouble_id = trouble_id;
        this.lat = lat;
        this.lng = lng;
        this.status = status;
    }

    @Generated(hash = 1205226300)
    public LocalPlanRecordBean() {
    }

    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 getPlan_Point_id() {
        return this.plan_Point_id;
    }

    public void setPlan_Point_id(String plan_Point_id) {
        this.plan_Point_id = plan_Point_id;
    }

    public String getPoint_id() {
        return this.point_id;
    }

    public void setPoint_id(String point_id) {
        this.point_id = point_id;
    }

    public String getChild_plan_id() {
        return this.child_plan_id;
    }

    public void setChild_plan_id(String child_plan_id) {
        this.child_plan_id = child_plan_id;
    }

    public String getPlan_id() {
        return this.plan_id;
    }

    public void setPlan_id(String plan_id) {
        this.plan_id = plan_id;
    }

    public String getTrouble_id() {
        return this.trouble_id;
    }

    public void setTrouble_id(String trouble_id) {
        this.trouble_id = trouble_id;
    }

    public String getLat() {
        return this.lat;
    }

    public void setLat(String lat) {
        this.lat = lat;
    }

    public String getLng() {
        return this.lng;
    }

    public void setLng(String lng) {
        this.lng = lng;
    }

    public int getStatus() {
        return this.status;
    }

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

    public String getId() {
        return this.id;
    }

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

    public LocalPlanRecordBean(OfflinePathBean planPoint, String notes) {
        String recordId = UUID.randomUUID().toString();
        this.setId(recordId);
        this.setPlan_Point_id(planPoint.getTemp_id());
        this.setChild_plan_id(planPoint.getPlan_id());
        this.setPlan_id(planPoint.getPlan_id());
        this.setPoint_id(planPoint.getPoint_id());
        this.setTrouble_id(planPoint.getTrouble_id());
        this.setCreate_time(DateUtils.getCurrentDate());
        this.setLng(String.valueOf(planPoint.getLng()));
        this.setLat(String.valueOf(planPoint.getLat()));
        this.setNotes(notes);
    }
}
