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_THEME_ITEM".
 */
public class ThemeItem {

    /** Not-null value. */
     @SerializedName("uuid_theme_item")
    private String uuid_theme_item;
    /** Not-null value. */
     @SerializedName("theme_item")
    private String theme_item;
     @SerializedName("value")
    private String value;
     @SerializedName("uuid_theme")
    private String uuid_theme;

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

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

    private Theme theme;
    private String theme__resolvedKey;


    public ThemeItem() {
    }

    public ThemeItem(String uuid_theme_item) {
        this.uuid_theme_item = uuid_theme_item;
    }

    public ThemeItem(String uuid_theme_item, String theme_item, String value, String uuid_theme) {
        this.uuid_theme_item = uuid_theme_item;
        this.theme_item = theme_item;
        this.value = value;
        this.uuid_theme = uuid_theme;
    }

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

    /** Not-null value. */
    public String getUuid_theme_item() {
        return uuid_theme_item;
    }

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

    /** Not-null value. */
    public String getTheme_item() {
        return theme_item;
    }

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

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getUuid_theme() {
        return uuid_theme;
    }

    public void setUuid_theme(String uuid_theme) {
        this.uuid_theme = uuid_theme;
    }

    /** To-one relationship, resolved on first access. */
    public Theme getTheme() {
        String __key = this.uuid_theme;
        if (theme__resolvedKey == null || theme__resolvedKey != __key) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ThemeDao targetDao = daoSession.getThemeDao();
            Theme themeNew = targetDao.load(__key);
            synchronized (this) {
                theme = themeNew;
            	theme__resolvedKey = __key;
            }
        }
        return theme;
    }

    public void setTheme(Theme theme) {
        synchronized (this) {
            this.theme = theme;
            uuid_theme = theme == null ? null : theme.getUuid_theme();
            theme__resolvedKey = uuid_theme;
        }
    }

    /** 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);
    }

}
