/*  ADOBE CONFIDENTIAL
 *  ___________________
 *
 *  Copyright 2013 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 *  NOTICE:  All information contained herein is, and remains
 *  the property of Adobe Systems Incorporated and its suppliers,
 *  if any.  The intellectual and technical concepts contained
 *  herein are proprietary to Adobe Systems Incorporated and its
 *  suppliers and are protected by trade secret or copyright law.
 *  Dissemination of this information or reproduction of this material
 *  is strictly forbidden unless prior written permission is obtained
 *  from Adobe Systems Incorporated.
 *
 * ***********************************************************************
 */

package com.adobe.primetime.reference.feature.playback;

import java.util.ArrayList;
import java.util.List;

import com.adobe.mediacore.metadata.Metadata;
import org.json.JSONObject;

import com.adobe.primetime.reference.feeds.ContentRenditionInfo;
import com.adobe.primetime.reference.feeds.ContentRenditionInfo.ContentFormat;
import com.adobe.primetime.reference.feeds.ContentRenditionInfo.ContentType;
import com.adobe.primetime.reference.feeds.ReferencePlayerFeedItemAdapter;
import com.adobe.primetime.reference.utils.SerializableNameValuePair;

/**
 * FeedItemAdapter for providing a test feed, given a URL and ContentFormat.
 */
public class SimpleFeedItem extends ReferencePlayerFeedItemAdapter {

	private List<ContentRenditionInfo> hlsContent = new ArrayList<ContentRenditionInfo>();
	private List<ContentRenditionInfo> hdsContent = new ArrayList<ContentRenditionInfo>();
	private List<ContentRenditionInfo> content = new ArrayList<ContentRenditionInfo>();

	public SimpleFeedItem(ContentFormat format, String url) {
		super(new JSONObject());

		ContentRenditionInfo info = new ContentRenditionInfo(format, url, null);
		switch (format) {
		case hls:
			hlsContent.add(info);
			break;
		case hds:
			hdsContent.add(info);
			break;
		default:
			break;
		}
		content.add(info);

	}

	public SimpleFeedItem(ContentFormat format, String url,
			JSONObject jsonObject) {
		super(jsonObject);
		parseMetadata();

		ContentRenditionInfo info = new ContentRenditionInfo(format, url, null);
		switch (format) {
		case hls:
			hlsContent.add(info);
			break;
		case hds:
			hdsContent.add(info);
			break;
		default:
			break;
		}
		content.add(info);
	}

	@Override
	public String getId() {
		return null;
	}

	@Override
	public String getTitle() {
		return null;
	}

	@Override
	public ContentType getContentType() {
		return null;
	}

	@Override
	public List<ContentRenditionInfo> getHDSContentRenditions() {
		return hdsContent;
	}

	@Override
	public List<ContentRenditionInfo> getHLSContentRenditions() {

		return hlsContent;
	}

	@Override
	public List<ContentRenditionInfo> getContentRenditions() {
		return content;
	}

	@Override
	public Metadata getStreamMetadata() {
		return metadata;
	}

	@Override
	public String getStreamThumbnailLarge() {
		return null;
	}

	@Override
	public String getStreamThumbnailSmall() {
		return null;
	}

	@Override
	public List<SerializableNameValuePair> getProperties() {
		return null;
	}

}