package com.adins.mss.dao;

import com.adins.mss.dao.DaoSession;
import de.greenrobot.dao.DaoException;

import com.adins.mss.base.util.ExcludeFromGson;
import com.google.gson.annotations.SerializedName;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit. 
/**
 * Entity mapped to table "TR_PLAN_TASK".
 */
public class PlanTask {

    /** Not-null value. */
     @SerializedName("uuid_plan_task")
    private String uuid_plan_task;
     @SerializedName("sequence")
    private int sequence;
    /** Not-null value. */
     @SerializedName("plan_status")
    private String plan_status;
     @SerializedName("plan_start_date")
    private java.util.Date plan_start_date;
     @SerializedName("plan_crt_date")
    private java.util.Date plan_crt_date;
     @SerializedName("view_sequence")
    private Integer view_sequence;
    /** Not-null value. */
     @SerializedName("uuid_user")
    private String uuid_user;
    /** Not-null value. */
     @SerializedName("uuid_task_h")
    private String uuid_task_h;

    /** Used to resolve relations */
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    private transient PlanTaskDao myDao;

    private TaskH taskH;
    private String taskH__resolvedKey;

    private User user;
    private String user__resolvedKey;


    public PlanTask() {
    }

    public PlanTask(String uuid_plan_task) {
        this.uuid_plan_task = uuid_plan_task;
    }

    public PlanTask(String uuid_plan_task, int sequence, String plan_status, java.util.Date plan_start_date, java.util.Date plan_crt_date, Integer view_sequence, String uuid_user, String uuid_task_h) {
        this.uuid_plan_task = uuid_plan_task;
        this.sequence = sequence;
        this.plan_status = plan_status;
        this.plan_start_date = plan_start_date;
        this.plan_crt_date = plan_crt_date;
        this.view_sequence = view_sequence;
        this.uuid_user = uuid_user;
        this.uuid_task_h = uuid_task_h;
    }

    /** called by internal mechanisms, do not call yourself. */
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getPlanTaskDao() : null;
    }

    /** Not-null value. */
    public String getUuid_plan_task() {
        return uuid_plan_task;
    }

    /** Not-null value; ensure this value is available before it is saved to the database. */
    public void setUuid_plan_task(String uuid_plan_task) {
        this.uuid_plan_task = uuid_plan_task;
    }

    public int getSequence() {
        return sequence;
    }

    public void setSequence(int sequence) {
        this.sequence = sequence;
    }

    /** Not-null value. */
    public String getPlan_status() {
        return plan_status;
    }

    /** Not-null value; ensure this value is available before it is saved to the database. */
    public void setPlan_status(String plan_status) {
        this.plan_status = plan_status;
    }

    public java.util.Date getPlan_start_date() {
        return plan_start_date;
    }

    public void setPlan_start_date(java.util.Date plan_start_date) {
        this.plan_start_date = plan_start_date;
    }

    public java.util.Date getPlan_crt_date() {
        return plan_crt_date;
    }

    public void setPlan_crt_date(java.util.Date plan_crt_date) {
        this.plan_crt_date = plan_crt_date;
    }

    public Integer getView_sequence() {
        return view_sequence;
    }

    public void setView_sequence(Integer view_sequence) {
        this.view_sequence = view_sequence;
    }

    /** Not-null value. */
    public String getUuid_user() {
        return uuid_user;
    }

    /** Not-null value; ensure this value is available before it is saved to the database. */
    public void setUuid_user(String uuid_user) {
        this.uuid_user = uuid_user;
    }

    /** Not-null value. */
    public String getUuid_task_h() {
        return uuid_task_h;
    }

    /** Not-null value; ensure this value is available before it is saved to the database. */
    public void setUuid_task_h(String uuid_task_h) {
        this.uuid_task_h = uuid_task_h;
    }

    /** To-one relationship, resolved on first access. */
    public TaskH getTaskH() {
        String __key = this.uuid_task_h;
        if (taskH__resolvedKey == null || taskH__resolvedKey != __key) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            TaskHDao targetDao = daoSession.getTaskHDao();
            TaskH taskHNew = targetDao.load(__key);
            synchronized (this) {
                taskH = taskHNew;
            	taskH__resolvedKey = __key;
            }
        }
        return taskH;
    }

    public void setTaskH(TaskH taskH) {
        if (taskH == null) {
            throw new DaoException("To-one property 'uuid_task_h' has not-null constraint; cannot set to-one to null");
        }
        synchronized (this) {
            this.taskH = taskH;
            uuid_task_h = taskH.getUuid_task_h();
            taskH__resolvedKey = uuid_task_h;
        }
    }

    /** To-one relationship, resolved on first access. */
    public User getUser() {
        String __key = this.uuid_user;
        if (user__resolvedKey == null || user__resolvedKey != __key) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            UserDao targetDao = daoSession.getUserDao();
            User userNew = targetDao.load(__key);
            synchronized (this) {
                user = userNew;
            	user__resolvedKey = __key;
            }
        }
        return user;
    }

    public void setUser(User user) {
        if (user == null) {
            throw new DaoException("To-one property 'uuid_user' has not-null constraint; cannot set to-one to null");
        }
        synchronized (this) {
            this.user = user;
            uuid_user = user.getUuid_user();
            user__resolvedKey = uuid_user;
        }
    }

    /** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }    
        myDao.delete(this);
    }

    /** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }    
        myDao.update(this);
    }

    /** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }    
        myDao.refresh(this);
    }

}
