/** @file MOMProgramme.h
 *
 * Copyright (C) Espial Limited 2014 - Company confidential - All rights reserved.
 *
 */

#ifndef MOMProgramme_h
#define MOMProgramme_h

#if ENABLE(RMAI)

#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/text/AtomicString.h>
#include "MOMContentItem.h"
#include "MOMStringCollection.h"

extern "C" {
#include "layers.h"
#include "cdf/mom_programme.h"
}

namespace WebCore {

class MOMPurchasableAsset;
class MOMReminder;
class MOMChannel;

class MOMProgramme : public MOMContentItem {
public:
    enum {
        FILLER_NONE = 0,
        FILLER_GAP = 1,
        FILLER_START = 2,
        FILLER_END = 3,
        FILLER_VIRTUAL = 4,
        SHOW_TYPE_LIVE = 1,
        SHOW_TYPE_FIRST_RUN = 2,
        SHOW_TYPE_RERUN = 3,
        MONO = 1,
        STEREO = 2,
        MULTICHANNEL = 4,
        MULTICHANNEL_ENHANCED = 8,
    };

    static RefPtr<MOMProgramme> create(ScriptExecutionContext *context, MOMChannel* chan, int startTime, int duration, ExceptionCode& ec);
    static RefPtr<MOMProgramme> createAdopt(ScriptExecutionContext *context, mom_programme prog);
    MOMProgramme(ScriptExecutionContext *context, mom_content_item item);

    int startTime() const;
    int duration() const;
    int filler() const;
    int releaseYear() const;
    bool hasRecording() const;
    MOMContentItem* channel() const;
    PassRefPtr<MOMContentItem> scheduledRecording() const;
    MOMContentItem* recordings() const;
    int length() const;
    PassRefPtr<MOMReminder> reminder() const;
    int starRating() const;
    bool subtitles() const;
    bool sapAvailable() const;
    bool isMultilingual() const;
    String episodeTitle() const;
    MOMStringCollection* contentAdvisory() const;
    int episode() const;
    int totalEpisodes() const;
    int showType() const;
    bool isHD() const;
    bool isWidescreen() const;
    int audioType() const;
    MOMStringCollection* genre() const;
    int purchased() const;

    PassRefPtr<MOMContentItem> item( int index );
    void setBookmark( int bookmark );

    ALWAYS_INLINE mom_programme itemAsProgramme() const { return (mom_programme)m_item; };

private:
    mutable RefPtr<MOMContentItem> m_channel;
    mutable RefPtr<MOMStringCollection> m_genre;
    mutable RefPtr<MOMStringCollection> m_contentAdvisory;
};

} // namespace WebCore

#endif // ENABLE(RMAI)

#endif // MOMProgramme_h
