package com.sharefaith.thesharefaithapp.models;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by Anthony on 12/9/16.
 * Model for Video Stream
 */

public class SFVideoStreamModel
{
    public String mTopId = "";
    public String mTitle = "";
    public String mDescription = "";
    public String mImageURL = "";
    public String mPosition = "";
    public String mResourceId = "";
    public String mId = "";
    public String mTimestamp = "";
    public String mType = "";
    public String mContentType = "";
    public String mContent = "";
    public String mSource = "";

    public SFVideoStreamModel( JSONObject data, String source )
    {
        refreshMembers( data, source );
    }

    public void refreshMembers( JSONObject data, String source )
    {
        this.mTitle = "";
        this.mTopId = "";
        this.mTitle = "";
        this.mDescription = "";
        this.mImageURL = "";
        this.mPosition = "";
        this.mResourceId = "";
        this.mId = "";
        this.mTimestamp = "";
        this.mType = "";
        this.mContentType = "";
        this.mContent = "";
        this.mSource = source;

        try
        {
            this.mTopId = data.get( "topId" ).toString();
            this.mTitle = data.get( "title" ).toString();
            this.mDescription = data.get( "description" ).toString();
            this.mImageURL = data.get( "image" ).toString();
            this.mPosition = data.get( "position" ).toString();
            this.mResourceId = data.get( "resourceId" ).toString();
            this.mId = data.get( "id" ).toString();
            this.mTimestamp = data.get( "timestamp" ).toString();
            this.mType = data.get( "type" ).toString();
            this.mContentType = data.get( "contentType" ).toString();
            this.mContent = data.get( "content" ).toString();
        } catch (JSONException e)
        {
            e.printStackTrace();
        }
    }
}
