package com.adins.mss.dao;

import java.util.List;
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".
 */
public class Theme {

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

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

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

    private List<ThemeItem> themeItemList;

    public Theme() {
    }

    public Theme(String uuid_theme) {
        this.uuid_theme = uuid_theme;
    }

    public Theme(String uuid_theme, String application_type, String version) {
        this.uuid_theme = uuid_theme;
        this.application_type = application_type;
        this.version = version;
    }

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

    /** Not-null value. */
    public String getUuid_theme() {
        return uuid_theme;
    }

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

    /** Not-null value. */
    public String getApplication_type() {
        return application_type;
    }

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

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<ThemeItem> getThemeItemList() {
        if (themeItemList == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ThemeItemDao targetDao = daoSession.getThemeItemDao();
            List<ThemeItem> themeItemListNew = targetDao._queryTheme_ThemeItemList(uuid_theme);
            synchronized (this) {
                if(themeItemList == null) {
                    themeItemList = themeItemListNew;
                }
            }
        }
        return themeItemList;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetThemeItemList() {
        themeItemList = null;
    }

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

}
