package com.cc.infosur.greendao;

import java.util.List;
import de.greenrobot.dao.DaoException;

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

    private Long id;
    private Integer etpParkId;
    private Integer eppParkId;
    private Boolean restricted;
    private Integer timeoutTimefencingTraveller;
    private Integer timeoutGeofencingTraveller;
    private Integer timeoutTripviolationTraveller;
    private Integer timeoutTimefencingParkmanager;
    private Integer timeoutGeofencingParkmanager;
    private Integer timeoutTripviolationParkmanager;
    private Long boundaryId;

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

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

    private DbPolygon boundary;
    private Long boundary__resolvedKey;

    private List<MonthOpeningTime> monthsOpeningTime;
    private List<DbPolygon> restrictedAreas;
    private List<DbPolygon> accommodationAreas;

    public ParkInfo() {
    }

    public ParkInfo(Long id) {
        this.id = id;
    }

    public ParkInfo(Long id, Integer etpParkId, Integer eppParkId, Boolean restricted, Integer timeoutTimefencingTraveller, Integer timeoutGeofencingTraveller, Integer timeoutTripviolationTraveller, Integer timeoutTimefencingParkmanager, Integer timeoutGeofencingParkmanager, Integer timeoutTripviolationParkmanager, Long boundaryId) {
        this.id = id;
        this.etpParkId = etpParkId;
        this.eppParkId = eppParkId;
        this.restricted = restricted;
        this.timeoutTimefencingTraveller = timeoutTimefencingTraveller;
        this.timeoutGeofencingTraveller = timeoutGeofencingTraveller;
        this.timeoutTripviolationTraveller = timeoutTripviolationTraveller;
        this.timeoutTimefencingParkmanager = timeoutTimefencingParkmanager;
        this.timeoutGeofencingParkmanager = timeoutGeofencingParkmanager;
        this.timeoutTripviolationParkmanager = timeoutTripviolationParkmanager;
        this.boundaryId = boundaryId;
    }

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

    public Long getId() {
        return id;
    }

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

    public Integer getEtpParkId() {
        return etpParkId;
    }

    public void setEtpParkId(Integer etpParkId) {
        this.etpParkId = etpParkId;
    }

    public Integer getEppParkId() {
        return eppParkId;
    }

    public void setEppParkId(Integer eppParkId) {
        this.eppParkId = eppParkId;
    }

    public Boolean getRestricted() {
        return restricted;
    }

    public void setRestricted(Boolean restricted) {
        this.restricted = restricted;
    }

    public Integer getTimeoutTimefencingTraveller() {
        return timeoutTimefencingTraveller;
    }

    public void setTimeoutTimefencingTraveller(Integer timeoutTimefencingTraveller) {
        this.timeoutTimefencingTraveller = timeoutTimefencingTraveller;
    }

    public Integer getTimeoutGeofencingTraveller() {
        return timeoutGeofencingTraveller;
    }

    public void setTimeoutGeofencingTraveller(Integer timeoutGeofencingTraveller) {
        this.timeoutGeofencingTraveller = timeoutGeofencingTraveller;
    }

    public Integer getTimeoutTripviolationTraveller() {
        return timeoutTripviolationTraveller;
    }

    public void setTimeoutTripviolationTraveller(Integer timeoutTripviolationTraveller) {
        this.timeoutTripviolationTraveller = timeoutTripviolationTraveller;
    }

    public Integer getTimeoutTimefencingParkmanager() {
        return timeoutTimefencingParkmanager;
    }

    public void setTimeoutTimefencingParkmanager(Integer timeoutTimefencingParkmanager) {
        this.timeoutTimefencingParkmanager = timeoutTimefencingParkmanager;
    }

    public Integer getTimeoutGeofencingParkmanager() {
        return timeoutGeofencingParkmanager;
    }

    public void setTimeoutGeofencingParkmanager(Integer timeoutGeofencingParkmanager) {
        this.timeoutGeofencingParkmanager = timeoutGeofencingParkmanager;
    }

    public Integer getTimeoutTripviolationParkmanager() {
        return timeoutTripviolationParkmanager;
    }

    public void setTimeoutTripviolationParkmanager(Integer timeoutTripviolationParkmanager) {
        this.timeoutTripviolationParkmanager = timeoutTripviolationParkmanager;
    }

    public Long getBoundaryId() {
        return boundaryId;
    }

    public void setBoundaryId(Long boundaryId) {
        this.boundaryId = boundaryId;
    }

    /** To-one relationship, resolved on first access. */
    public DbPolygon getBoundary() {
        Long __key = this.boundaryId;
        if (boundary__resolvedKey == null || !boundary__resolvedKey.equals(__key)) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            DbPolygonDao targetDao = daoSession.getDbPolygonDao();
            DbPolygon boundaryNew = targetDao.load(__key);
            synchronized (this) {
                boundary = boundaryNew;
            	boundary__resolvedKey = __key;
            }
        }
        return boundary;
    }

    public void setBoundary(DbPolygon boundary) {
        synchronized (this) {
            this.boundary = boundary;
            boundaryId = boundary == null ? null : boundary.getId();
            boundary__resolvedKey = boundaryId;
        }
    }

    /** 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<MonthOpeningTime> getMonthsOpeningTime() {
        if (monthsOpeningTime == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            MonthOpeningTimeDao targetDao = daoSession.getMonthOpeningTimeDao();
            List<MonthOpeningTime> monthsOpeningTimeNew = targetDao._queryParkInfo_MonthsOpeningTime(id);
            synchronized (this) {
                if(monthsOpeningTime == null) {
                    monthsOpeningTime = monthsOpeningTimeNew;
                }
            }
        }
        return monthsOpeningTime;
    }

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

    /** 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<DbPolygon> getRestrictedAreas() {
        if (restrictedAreas == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            DbPolygonDao targetDao = daoSession.getDbPolygonDao();
            List<DbPolygon> restrictedAreasNew = targetDao._queryParkInfo_RestrictedAreas(id);
            synchronized (this) {
                if(restrictedAreas == null) {
                    restrictedAreas = restrictedAreasNew;
                }
            }
        }
        return restrictedAreas;
    }

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

    /** 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<DbPolygon> getAccommodationAreas() {
        if (accommodationAreas == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            DbPolygonDao targetDao = daoSession.getDbPolygonDao();
            List<DbPolygon> accommodationAreasNew = targetDao._queryParkInfo_AccommodationAreas(id);
            synchronized (this) {
                if(accommodationAreas == null) {
                    accommodationAreas = accommodationAreasNew;
                }
            }
        }
        return accommodationAreas;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetAccommodationAreas() {
        accommodationAreas = 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);
    }

}
