/*******************************************************************************
 * ADOBE CONFIDENTIAL
 *  ___________________
 *
 *  Copyright 2014 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.ui.entitlement;

import android.os.Parcel;
import android.os.Parcelable;
import com.adobe.adobepass.accessenabler.models.Mvpd;

public class MvpdListItem implements Parcelable
{
    private final Mvpd mvpd;

    public MvpdListItem(Mvpd mvpd)
    {
        this.mvpd = mvpd;
    }

    public MvpdListItem(Parcel in)
    {
        this.mvpd = (Mvpd) in.readSerializable();
    }

    public Mvpd getMvpd()
    {
        return mvpd;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MvpdListItem that = (MvpdListItem) o;

        if (mvpd != null)
        {
            if (!mvpd.equals(that.mvpd)) return false;
        }
        else
        {
            if (that.mvpd != null) return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        if (mvpd != null) return mvpd.hashCode();
        else return 0;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeSerializable(mvpd);
    }

    public static final Creator<MvpdListItem> CREATOR = new Creator<MvpdListItem>() {
        @Override
        public MvpdListItem createFromParcel(Parcel source) {
            return new MvpdListItem(source);
        }

        @Override
        public MvpdListItem[] newArray(int size) {
            return new MvpdListItem[size];
        }
    };
}
