package app.lsgui.model.twitch;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import app.lsgui.serviceapi.twitch.TwitchStreamData;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.LongProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.image.Image;

public class TwitchStreamModel {

    private static final Logger LOGGER = LoggerFactory.getLogger(TwitchStreamModel.class);
    // TODO Choose other default image
    private static final String DEFAULT_CHANNEL_LOGO = "http://static-cdn.jtvnw.net/jtv_user_pictures/xarth/404_user_150x150.png";

    private StringProperty name;
    private StringProperty logoURL;
    private StringProperty previewURL;
    private StringProperty game;
    private StringProperty title;
    private LongProperty uptime;
    private IntegerProperty viewers;
    private BooleanProperty online;
    private ObjectProperty<Image> previewImage;

    public TwitchStreamModel(TwitchStreamData data) {

    }

    /**
     * @return the name
     */
    public StringProperty getName() {
        return name;
    }

    /**
     * @param name
     *            the name to set
     */
    public void setName(StringProperty name) {
        this.name = name;
    }

    /**
     * @return the logoURL
     */
    public StringProperty getLogoURL() {
        return logoURL;
    }

    /**
     * @param logoURL
     *            the logoURL to set
     */
    public void setLogoURL(StringProperty logoURL) {
        this.logoURL = logoURL;
    }

    /**
     * @return the previewURL
     */
    public StringProperty getPreviewURL() {
        return previewURL;
    }

    /**
     * @param previewURL
     *            the previewURL to set
     */
    public void setPreviewURL(StringProperty previewURL) {
        this.previewURL = previewURL;
    }

    /**
     * @return the game
     */
    public StringProperty getGame() {
        return game;
    }

    /**
     * @param game
     *            the game to set
     */
    public void setGame(StringProperty game) {
        this.game = game;
    }

    /**
     * @return the title
     */
    public StringProperty getTitle() {
        return title;
    }

    /**
     * @param title
     *            the title to set
     */
    public void setTitle(StringProperty title) {
        this.title = title;
    }

    /**
     * @return the uptime
     */
    public LongProperty getUptime() {
        return uptime;
    }

    /**
     * @param uptime
     *            the uptime to set
     */
    public void setUptime(LongProperty uptime) {
        this.uptime = uptime;
    }

    /**
     * @return the viewers
     */
    public IntegerProperty getViewers() {
        return viewers;
    }

    /**
     * @param viewers
     *            the viewers to set
     */
    public void setViewers(IntegerProperty viewers) {
        this.viewers = viewers;
    }

    /**
     * @return the online
     */
    public BooleanProperty getOnline() {
        return online;
    }

    /**
     * @param online
     *            the online to set
     */
    public void setOnline(BooleanProperty online) {
        this.online = online;
    }

    /**
     * @return the previewImage
     */
    public ObjectProperty<Image> getPreviewImage() {
        return previewImage;
    }

    /**
     * @param previewImage
     *            the previewImage to set
     */
    public void setPreviewImage(ObjectProperty<Image> previewImage) {
        this.previewImage = previewImage;
    }

}

@@ -85,24 +85,61 @@
 Factory;%0D%0A%0D%0A
+import app.lsgui.model.StreamModel;%0D%0A
 import app.l
@@ -154,11 +154,8 @@
 vice
-api
 .twi
@@ -353,32 +353,292 @@
 bjectProperty;%0D%0A
+import javafx.beans.property.SimpleBooleanProperty;%0D%0Aimport javafx.beans.property.SimpleIntegerProperty;%0D%0Aimport javafx.beans.property.SimpleLongProperty;%0D%0Aimport javafx.beans.property.SimpleObjectProperty;%0D%0Aimport javafx.beans.property.SimpleStringProperty;%0D%0A
 import javafx.be
@@ -734,16 +734,39 @@
 amModel 
+implements StreamModel 
 %7B%0D%0A%0D%0A   
@@ -1000,13 +1000,14 @@
 res/
-xarth
+nuamor
 /404
@@ -1398,16 +1398,22 @@
 amModel(
+final 
 TwitchSt
@@ -1433,32 +1433,589 @@
 ) %7B%0D%0A%0D%0A    %7D%0D%0A%0D%0A
+    public TwitchStreamModel(final String name) %7B%0D%0A        this.name = new SimpleStringProperty(name);%0D%0A        this.logoURL = new SimpleStringProperty(%22%22);%0D%0A        this.previewURL = new SimpleStringProperty(%22%22);%0D%0A        this.game = new SimpleStringProperty(%22%22);%0D%0A        this.title = new SimpleStringProperty(%22%22);%0D%0A        this.uptime = new SimpleLongProperty(0L);%0D%0A        this.viewers = new SimpleIntegerProperty(0);%0D%0A        this.online = new SimpleBooleanProperty(false);%0D%0A        this.previewImage = new SimpleObjectProperty%3CImage%3E(null);%0D%0A    %7D%0D%0A%0D%0A
     /**%0D%0A     * 

initialize variables