/**
 * @fileoverview
 * This file contains the Pluck base manager class that all other managers extends from.
 */

/**
 * Base Pluck Manager.
 * @constructor
 * @author Matt York
 * @version 1.0
 */
com.rogers.socialmedia.core.pluck.manager.PluckBaseManager = function(config){
    
    /** A default maximum results for requesting lists of things */
    this.DEF_MAX_ITEMS = 5; 
    /** A default for sort order */
    this.DEF_SORT = "TimeStampDescending";  
    //var apiKey;
    /** The site domain */
    var domain; // eg. todaysparent.com
    /** The site life subdomain (Usually sitelife for production and sitelifestage for development). 
    * Set by GlobalConfig @see com.rogers.socialmedia.core.pluck.GlobalConfig
    */
    var siteLifeSubdomain; // eg. sitelifestage for sitelifestage.todaysparent.com (testing)
    /**
     * The base URL used for contacting SiteLife.
     */
    var siteLifeBaseURL;
    /**
     * The URL used for the SiteLife DAAPI.
     */
    var directProxyURL;
    
    if(config){
        if(config.domain){domain = config.domain}else{domain=location.host};
        if(config.subdomain){subdomain = config.subdomain}else{throw "Pluck 'subdomain' property must be configured.";return;};
    }
    else if(com.rogers.socialmedia.core.pluck.GlobalConfig){
        if(com.rogers.socialmedia.core.pluck.GlobalConfig.domain){domain = com.rogers.socialmedia.core.pluck.GlobalConfig.domain}else{domain=location.host};
        if(com.rogers.socialmedia.core.pluck.GlobalConfig.subdomain){subdomain = com.rogers.socialmedia.core.pluck.GlobalConfig.subdomain}else{throw "Pluck 'subdomain' property must be configured.";return;};
    }
	else{
		throw "Pluck needs configuration.";
        return;
	}
	siteLifeBaseURL = location.protocol + "//" + subdomain + "." + domain;
    directProxyURL = siteLifeBaseURL + "/ver1.0/Direct/Process"; // for DAAPI
    
    /**
     * Returns the SiteLife baseURL
     * @return {String} The SiteLife base URL
     */
    this.getSiteLifeBaseURL = function(){
        return siteLifeBaseURL;
    }
    
    /**
     * Returns the SiteLife direct proxy URL
     * @return {String} The SiteLife direct proxy URL
     */
    this.getDirectProxyURL = function(){
        return directProxyURL;
    }
    
    this.getPageURL = function(){
        return location.href;
    }
    
    this.getPageTitle = function(){
        return document.title;
    }
};