package com.wasu.cs.model;

import java.io.Serializable;
import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONObject;

public class DemandPlayinfo implements Serializable {
	public void setRate(long rate) {
		this.rate = rate;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}

	private static final long serialVersionUID = -1181749620938514898L;
	/*
	 * "tag":"", "rate":7800, "items":[{ "itemId":11, "title":"", "episode":5,
	 * "playUrls":["",""], "datetime":"", }]
	 */
	private long rate; // 码流信息
	private String tag;// 标签名称，如高清

	private ArrayList<DemandSeries> mSeriesList = new ArrayList<DemandSeries>();

	public DemandPlayinfo(JSONObject jsondata) {

		createFrom(jsondata);
	}

	public DemandPlayinfo() {
	}

	public void createFrom(JSONObject jsondata) {
		rate = jsondata.optLong("rate");
		tag = jsondata.optString("tag");

		JSONArray array = jsondata.optJSONArray("items");
		if (array != null) {
			for (int i = 0; i < array.length(); i++) {
				mSeriesList.add(new DemandSeries(array.optJSONObject(i)));
			}
		}
	}

	public ArrayList<DemandSeries> getmSeriesList() {
		return mSeriesList;
	}

	public void setmSeriesList(ArrayList<DemandSeries> mSeriesList) {
		this.mSeriesList = mSeriesList;
	}

	public long getRate() {
		return rate;
	}

	public String getTag() {
		return tag;
	}

	public ArrayList<DemandSeries> getSeriesList() {
		return mSeriesList;
	}
}
