const FLOCK_PHOTO_ACCOUNT_CID = Components.ID('{de386250-c9bd-11da-a94d-0800200c9a66}');
const FLOCK_PHOTO_ACCOUNT_CONTRACTID = '@flock.com/photo-account;1';
const FLOCK_PHOTO_ACCOUNT_IID = Components.interfaces.flockIPhotoAccount;


function flockPhotoAccount() {
}

flockPhotoAccount.prototype= {
    username: "",
    maxSpace: "",
    usedSpace: "",
    maxFileSize: "",
    usageUnits: "",
    isPremium: false,

    QueryInterface: function(iid) {
        if (!iid.equals(Components.interfaces.nsISupports) &&
            !iid.equals(FLOCK_PHOTO_ACCOUNT_IID))
            throw Components.results.NS_ERROR_NO_INTERFACE;
        return this;
    }
};


var flockPhotoAccountModule = {
    registerSelf: function(compMgr, fileSpec, location, type) {
        compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
        compMgr.registerFactoryLocation(FLOCK_PHOTO_ACCOUNT_CID, 
                                        "flockPhotoAccount JS component", 
                                        FLOCK_PHOTO_ACCOUNT_CONTRACTID, 
                                        fileSpec, 
                                        location,
                                        type);
    },

    getClassObject: function(compMgr, cid, iid) {
        if (!cid.equals(FLOCK_PHOTO_ACCOUNT_CID))
            throw Components.results.NS_ERROR_NO_INTERFACE;

        if (!iid.equals(Components.interfaces.nsIFactory))
            throw Components.results.NS_ERROR_NOT_IMPLEMENTED;

        return flockPhotoAccountFactory;
    },

    canUnload: function(compMgr) { return true; }
};

var flockPhotoAccountFactory = {
    createInstance: function(outer, iid) {
        if (outer != null)
            throw Components.results.NS_ERROR_NO_AGGREGATION;
    
        if (!iid.equals(FLOCK_PHOTO_ACCOUNT_IID) &&
            !iid.equals(Components.interfaces.nsISupports))
            throw Components.results.NS_ERROR_INVALID_ARG;

        return new flockPhotoAccount();
    }
}

/* module initialisation */
function NSGetModule(comMgr, fileSpec) { return flockPhotoAccountModule; }

