/*
 * BEGIN FLOCK GPL
 *
 * Copyright Flock Inc. 2005-2009
 * http://flock.com
 *
 * This file may be used under the terms of the
 * GNU General Public License Version 2 or later (the "GPL"),
 * http://www.gnu.org/licenses/gpl.html
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * END FLOCK GPL
 */

#include "nsISupports.idl"
#include "flockIError.idl"

[scriptable, uuid(c4ef02f3-0231-471f-b0f6-c9015d09c5ff)]
interface flockIXmlRpcValue : nsISupports {
    const unsigned long TYPE_INT = 1;
    const unsigned long TYPE_BOOLEAN = 2;
    const unsigned long TYPE_STRING = 3;
    const unsigned long TYPE_DOUBLE = 4;
    const unsigned long TYPE_DATETIME = 5;
    const unsigned long TYPE_ARRAY = 6;
    const unsigned long TYPE_STRUCT = 7;
    const unsigned long TYPE_BASE64 = 8;
    readonly attribute unsigned long XmlRpcType;

    readonly attribute long IntValue;
    readonly attribute boolean BooleanValue;
    readonly attribute AString StringValue;
    readonly attribute double DoubleValue;
    readonly attribute unsigned long DateTimeValue;
    void ArrayElements (out PRUint32 aCount, 
            [retval, array, size_is(aCount)] out flockIXmlRpcValue aElements);
    void StructKeys (out PRUint32 aCount, 
            [retval, array, size_is(aCount)] out string aKeys);
    flockIXmlRpcValue StructItem (in string aKey);
    readonly attribute ACString Base64Value;
};

[scriptable, uuid(edf6121e-5896-4378-abaf-66c5e9b137c5)]
interface flockIXmlRpcListener : nsISupports {
    void onResult (in flockIXmlRpcValue aResult);
    void onFault (in flockIError aFlockError);
    void onError (in flockIError aFlockError);
};

[scriptable, uuid(ed567267-a11a-4526-8e29-6af6001818cc)]
interface flockIXmlRpcServer : nsISupports {
    void init (in string aURL);

    void call (in string aMethod,
               in flockIXmlRpcValue aArguments /* must be array */,
               in flockIXmlRpcListener aRpcListener);
};
/* TODO:
    - add timeout support
*/
