/* Copyright 2009 Palm, Inc.  All rights reserved. */

var AccountsService = Class.create({
    initialize: function(){

    },
	
    getAllAccountTypesForService: function(sceneController, type, callback){
        return sceneController.serviceRequest(AccountsService.identifier, {
            method: 'getAllAccountTypesForService',
            parameters: {
                service: type,
                subscribe: true,
                includeAll: false
            },
            onSuccess: callback
        });
    },
    
    removeService: function(sceneController, accountId, callback){
        return sceneController.serviceRequest(AccountsService.identifier, {
            method: 'removeService',
            parameters: {
                service: AccountsService.CONTACTS,
                accountId: accountId
            },
            onSuccess: callback
        });
    },
    
    getAllAccountsForService: function(sceneController, type, includeHidden, callback, types){
    var params = {
            method: 'getAllAccountsForService',
            parameters: {
                subscribe: true,
                includeHidden: includeHidden
            },
            onSuccess: callback
        };
		if(type){
			params.parameters.service = type;
		} else {
			params.parameters.services = types;
		}
		if (sceneController) {
			return sceneController.serviceRequest(AccountsService.identifier, params);
		} else {
			return new Mojo.Service.Request(AccountsService.identifier, params, {resubscribe:true});
		}
    }
});

AccountsService.identifier = 'palm://com.palm.accounts';
AccountsService.CONTACTS = "CONTACTS";
AccountsService.IM = "IM";
AccountsService.CALENDAR = "CALENDAR";
