// Path: src/main/java/org/chorem/ecd/model/settings/Location.java
// public class Location {
//     private int id;
// 
//     private String name;
// 
//     private String weatherForecastUrl;
// 
//     public Location() {
//     }
// 
//     public Location(String name, String weatherForecastUrl) {
//         this.name = name;
//         this.weatherForecastUrl = weatherForecastUrl;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getWeatherForecastUrl() {
//         return weatherForecastUrl;
//     }
// 
//     public void setWeatherForecastUrl(String weatherForecastUrl) {
//         this.weatherForecastUrl = weatherForecastUrl;
//     }
// 
// }
// 
// Path: src/main/java/org/chorem/ecd/model/settings/Settings.java
// public class Settings {
//     private Location location;
// 
//     private TvTimes tvTimes;
// 
//     public Location getLocation() {
//         return location;
//     }
// 
//     public void setLocation(Location location) {
//         this.location = location;
//     }
// 
//     public TvTimes getTvTimes() {
//         return tvTimes;
//     }
// 
//     public void setTvTimes(TvTimes tvTimes) {
//         this.tvTimes = tvTimes;
//     }
// }
// 
// Path: src/main/java/org/chorem/ecd/model/settings/TvTimes.java
// public class TvTimes {
// 
//     private String wakeupTime;
// 
//     private String sleepTime;
// 
//     public TvTimes() {
// 
//     }
// 
//     public TvTimes(String wakeupTime, String sleepTime) {
//         this.wakeupTime = wakeupTime;
//         this.sleepTime = sleepTime;
//     }
// 
//     public String getWakeupTime() {
//         return wakeupTime;
//     }
// 
//     public void setWakeupTime(String wakeupTime) {
//         this.wakeupTime = wakeupTime;
//     }
// 
//     public String getSleepTime() {
//         return sleepTime;
//     }
// 
//     public void setSleepTime(String sleepTime) {
//         this.sleepTime = sleepTime;
//     }
// 
// }


import org.chorem.ecd.model.settings.Location;
import org.chorem.ecd.model.settings.Settings;
import org.chorem.ecd.model.settings.TvTimes;
import org.jooq.DSLContext;
import org.jooq.Record;
import org.jooq.RecordMapper;
import org.jooq.impl.DSL;
import org.jooq.util.postgres.PostgresDataType;
import javax.enterprise.context.ApplicationScoped;
import java.util.Optional;
import static org.chorem.ecd.mapping.tables.Settings.SETTINGS;
package org.chorem.ecd.dao;





/**
 * @author Julien Gaston (gaston@codelutin.com)
 */
@ApplicationScoped
public class SettingsDao extends AbstractDao<Settings, Integer> {

    public SettingsDao() {
        super(Settings.class, SETTINGS, SETTINGS.ID::eq);
    }

    public TvTimes getTvTimes() {
        DSLContext create = dataSource.getSqlContext();
        TvTimes result = create.select(SETTINGS.TV_TIMES).from(SETTINGS).where(SETTINGS.ID.eq(1))
                .fetchOptionalInto(String.class)
                .map(json -> gson.fromJson(json, TvTimes.class))
                .orElse(new TvTimes());
        return result;
    }

// Path: src/main/java/org/chorem/ecd/model/settings/Location.java
// public class Location {
//     private int id;
// 
//     private String name;
// 
//     private String weatherForecastUrl;
// 
//     public Location() {
//     }
// 
//     public Location(String name, String weatherForecastUrl) {
//         this.name = name;
//         this.weatherForecastUrl = weatherForecastUrl;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getWeatherForecastUrl() {
//         return weatherForecastUrl;
//     }
// 
//     public void setWeatherForecastUrl(String weatherForecastUrl) {
//         this.weatherForecastUrl = weatherForecastUrl;
//     }
// 
// }
// 
// Path: src/main/java/org/chorem/ecd/model/settings/Settings.java
// public class Settings {
//     private Location location;
// 
//     private TvTimes tvTimes;
// 
//     public Location getLocation() {
//         return location;
//     }
// 
//     public void setLocation(Location location) {
//         this.location = location;
//     }
// 
//     public TvTimes getTvTimes() {
//         return tvTimes;
//     }
// 
//     public void setTvTimes(TvTimes tvTimes) {
//         this.tvTimes = tvTimes;
//     }
// }
// 
// Path: src/main/java/org/chorem/ecd/model/settings/TvTimes.java
// public class TvTimes {
// 
//     private String wakeupTime;
// 
//     private String sleepTime;
// 
//     public TvTimes() {
// 
//     }
// 
//     public TvTimes(String wakeupTime, String sleepTime) {
//         this.wakeupTime = wakeupTime;
//         this.sleepTime = sleepTime;
//     }
// 
//     public String getWakeupTime() {
//         return wakeupTime;
//     }
// 
//     public void setWakeupTime(String wakeupTime) {
//         this.wakeupTime = wakeupTime;
//     }
// 
//     public String getSleepTime() {
//         return sleepTime;
//     }
// 
//     public void setSleepTime(String sleepTime) {
//         this.sleepTime = sleepTime;
//     }
// 
// }


// Path: src/main/java/org/chorem/ecd/dao/SettingsDao.java
import org.chorem.ecd.model.settings.Location;
import org.chorem.ecd.model.settings.Settings;
import org.chorem.ecd.model.settings.TvTimes;
import org.jooq.DSLContext;
import org.jooq.Record;
import org.jooq.RecordMapper;
import org.jooq.impl.DSL;
import org.jooq.util.postgres.PostgresDataType;
import javax.enterprise.context.ApplicationScoped;
import java.util.Optional;
import static org.chorem.ecd.mapping.tables.Settings.SETTINGS;

package org.chorem.ecd.dao;





/**
 * @author Julien Gaston (gaston@codelutin.com)
 */
@ApplicationScoped
public class SettingsDao extends AbstractDao<Settings, Integer> {

    public SettingsDao() {
        super(Settings.class, SETTINGS, SETTINGS.ID::eq);
    }

    public TvTimes getTvTimes() {
        DSLContext create = dataSource.getSqlContext();
        TvTimes result = create.select(SETTINGS.TV_TIMES).from(SETTINGS).where(SETTINGS.ID.eq(1))
                .fetchOptionalInto(String.class)
                .map(json -> gson.fromJson(json, TvTimes.class))
                .orElse(new TvTimes());
        return result;
    }

    public Location getLocation() {