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

#ifndef MOMChannel_h
#define MOMChannel_h

#if ENABLE(RMAI)

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

#include "ExceptionCode.h"

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

namespace WebCore {
    
class MOMChannel;
class MOMPlayer;
class MOMStringCollection;

class MOMChannel : public MOMContentItem {
public:
    enum {
        TYPE_TV = 0,
        TYPE_RADIO = 1,
        TYPE_DATA = 2,
        TYPE_VOD = 3,
        TYPE_PPV = 4,
        TYPE_PLAYLIST = 5,
        TYPE_VIRTUAL = 6,
        TYPE_DVR = 7,
        TYPE_SVOD = 8,
        TYPE_FORCE_TUNE = 9,
        TYPE_URI = 10,
        TYPE_WEB = 11,
        TYPE_MOSAIC = 12,
    };

    static PassRefPtr<MOMChannel> create(ScriptExecutionContext *context, const String& chan, const String& name, ExceptionCode& ec);
    static PassRefPtr<MOMChannel> createAdopt(ScriptExecutionContext *context, mom_channel chan);
    static PassRefPtr<MOMChannel> create(ScriptExecutionContext *context, mom_channel chan);
    MOMChannel(ScriptExecutionContext *context, mom_content_item item);

    int channelNumber() const;
    String source() const;
    int channelType() const;
    String serviceId() const;
    bool authorised() const;
    MOMStringCollection* genre() const;
    bool manualBlock() const;
    bool favourite() const;
    bool hidden() const;
    bool canRecord() const;
    bool canTrickPlay() const;
    bool displayInGuide() const;
    bool isVirtual() const;
    MOMChannel* equivalentHDChannel() const;
    String packageID() const;
    bool subscribed() const;

    void connect( MOMPlayer* player, ExceptionCode& ec );
    void connect( MOMPlayer* player, int mode, ExceptionCode& ec );
    String getLogo( int width, int height );

    ALWAYS_INLINE mom_channel itemAsChannel() const { return (mom_channel)m_item; }

private:
    mutable RefPtr<MOMStringCollection> m_genre;
    mutable RefPtr<MOMChannel> m_equivalentHDChannel;
};

} // namespace WebCore

#endif // ENABLE(RMAI)

#endif // MOMChannel_h
