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

#ifndef MOMContentSearch_h
#define MOMContentSearch_h

#if ENABLE(RMAI)

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

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

namespace WebCore {

class MOMContentItem;
class MOMStringCollection;


class MOMContentSearch : public MOMContentItem {
public:

    MOMContentSearch(ScriptExecutionContext *context, mom_content_item item);

    MOMContentItem* catalogue() const;
    MOMContentItem* results() const;
    String sort() const;
    void setSort(const String & sort);

    int searchType() const;

    void find( const String & searchKey, const String & searchValue );
    void abort();
    void reset();
    void addSearchTerm( const String & key, const String & value );
    void clearSearchTerm( );
    void clearSearchTerm( const String & key );
    void clearSearchTerm( const String & key, const String & value );
    PassRefPtr<MOMStringCollection> getSearchTerm( const String & key );
    int setParentalControlEnable( const String & PIN, bool enable );
    bool getParentalControlEnable();
    void addGenreConstraint( const String & genre );
    void clearGenreConstraint();
    void clearGenreConstraint( const String & genre );
    PassRefPtr<MOMStringCollection> getGenreConstraint();
    void addChannelConstraint( MOMContentItem* channels);
    void clearChannelConstraint( MOMContentItem* channels = 0);
    PassRefPtr<MOMContentItem> getChannelConstraint();
    void setStartTimeConstraint( int startTime );
    void setEndTimeConstraint( int endTime );
    int getStartTimeConstraint();
    int getEndTimeConstraint();
    void addConstraint( const String & key, const String & value );
    void clearConstraint();
    void clearConstraint( const String & key);
    void clearConstraint( const String & key, const String & value );
    PassRefPtr<MOMStringCollection> getConstraint( const String & key );

    ALWAYS_INLINE mom_content_search itemAsContentSearch() const { return (mom_content_search)m_item; }

private:
    mutable RefPtr<MOMContentItem> m_catalogue;
    mutable RefPtr<MOMContentItem> m_results;
};

} // namespace WebCore

#endif // ENABLE(RMAI)

#endif // MOMContentSearch_h
