/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsIUTF8StringEnumerator;
interface calITimezone;

[scriptable, uuid(331a7c6d-805a-4926-940b-2d78dcd90554)]
interface calITimezoneProvider : nsISupports
{
    readonly attribute nsIUTF8StringEnumerator timezoneIds;
    readonly attribute nsIUTF8StringEnumerator aliasIds;

    /**
     * Gets a timezone defintion passing a TZID.
     * Returns null in case of an unknown TZID.
     *
     * @param tzid       a TZID to be resolved
     * @return           a timezone object or null
     */
    calITimezone getTimezone(in AUTF8String tzid);
};

/**
 * This service acts as a central access point for the up to date set
 * of Olson timezone definitions.
 */
[scriptable, uuid(AB1BFE6A-EE95-4038-B594-34AEEDA9911A)]
interface calITimezoneService : calITimezoneProvider
{
    readonly attribute calITimezone floating;
    readonly attribute calITimezone UTC;

    /**
     * Provides the version of the underlying timezone database.
     */
    readonly attribute AString version;

    /**
     * Returns the default timezone from calendar.timezone.local. If no timezone
     * has been set, a best guess is taken from the operating system and the
     * timezone is saved into the above mentioned pref.
     */
    readonly attribute calITimezone defaultTimezone;
};
