/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *
 * This file is part of NMM. 
 * 
 * NMM is free software; you can redistribute it and/or modify it    
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; only version 2 of the License.      
 * 
 * NMM is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 
 * License for more details.  
 * 
 * You should have received a copy of the GNU General Public License 
 * along with NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

#include "nmm/plugins/video/tv/interfaces/tvguide/ITVGuidePlugin.idl"
#include "nmm/plugins/video/tv/interfaces/tvguide/ITVGuidePeerObject.idl"

module NMM {

  /**
   * Interface to access EPG. 
   */
  interface ITVGuide {

    /**
     * Adds a channel to the channel-list
     *\param id ID of the channel wich is used to find show of this channel
     *\param name Name of the channel
     */
    Result insertChannel(in string id = "", in string name = "");

    /**
     * Adds a channel to the channel-list
     *\param cd ChannelDescription to be added
     */
    Result insertChannelDescription(in ChannelDescription cd);

   /**
     * Adds an Event to the database
     *\param pd PrgoramDescription, containing the inrformation about the event
     */
    Result insertEvent(in ProgramDescription pd);

    /**
     * returns the path, where the XML-Files are stored
     *\return Path to XML-Files
     */
    string getDirectory();


    /**
     * Returns the Channels, for wich informaion is available
     *\return Channel-list
     */
    list<ChannelDescription> getChannelsList();

    /**
     * Returns the channel with the given ID
     *\param id ID of the channel
     *\return name of the channel, if available, empty string otherwise
     */
    string getChannelById(in string id);

    /**
     *Return the ID of the Channel with the given name
     *\param name name o the channel
     *\return ID of the requested channel, empty string if not found
     */
     string getChannelByName(in string name);

    /**
     *Returns the Event with the given starttime, endtime and channel
     *\param start StartTime of the Event
     *\param end EndTime of the Event
     *\param channel channel of the event
     *\return ProgramDescription containg the information about the event
     */
    ProgramDescription getEvent(in LocalTime start, in LocalTime end, in ChannelDescription channel);

    /**
     *Returns all show on the specified day and channel
     *\param day date of the day
     *\param channel channel
     *\return List of ProgramDescripytions containing the information of the shows
     */
    list<ProgramDescription> getEventsOnDayOnChannel(in LocalTime day, in ChannelDescription channel);

    /**
     * Returns a List with Events containing the given search-phrase
     *\param phrase Phrase to search for
     *\param peer Interface to the application the it is notified of new events
     *\return Event-Hitlist
     */
    list<ProgramDescription> search(in ProgramFilter pf, in ITVGuidePeerObject* peer = NULL);

    /**
     * returns the current event on the specified channel
     *\param channel channel_ID
     *@return current event in the specified channel
     */
    ProgramDescription getCurrentEventOnChannel(in ChannelDescription channel);

    /**
     * returns the next to current event on the specified channel
     *\param channel channel_ID
     *@return next event in the specified channel
     */
    ProgramDescription getFollowingEventOnChannel(in ChannelDescription channel);

    /** 
     * returns a list with all categories, stored in the DB
     *@return strin-list with categories
     */
    list<string> getCategories();

    /**
     * requests the TVGuide-Plugin-Interface specified in type
     *@return ITVGuideUpdatePlugin* interface of the requested grabber
     *@param type Type of TVGuidePlugin, wich is its plugin-name, eg IXMLTVPlugin
     */
    ITVGuidePlugin* getPluginInterface(in string type);

    /**
       clean up the database. specify the amount of days from today wich data should be kept. older data will be erased
    */
    void cleanDatabase(in nmm_int32 days);
  };
}
