/*

 Owner: Michael Ehrmann <michael@boinx.com>
 Company: Boinx Software Ltd., Germany
 Projects: BXServices, BXQuartzComposer

 Abstract: handels access to application specific default files on our webserver.

 Related: <#related#>

 Documentation: <#link to documentation#>

 */


#import <Foundation/Foundation.h>


// Keys in Info.plist
extern NSString *const BXInternalVersionKey;

// Keys in OnlineDefaults XML files
extern NSString *const BXModificationDate;

// Keys for locale support
extern NSString *const BXAllLocalesKey;
extern NSString *const BXLocaleNameKey;

// Keys for URLs
extern NSString *const BXCrashLogURLKey;
extern NSString *const BXFaqURLKey;
extern NSString *const BXFeedbackURLKey;
extern NSString *const BXProductURLKey;
extern NSString *const BXDownloadURLKey;
extern NSString *const BXBoinxURLKey;
extern NSString *const BXBoinxBackstageURLKey;
extern NSString *const BXFTPServerKey;
extern NSString *const BXHelpPageURLKey;
extern NSString *const BXCoachingURLKey;
extern NSString *const BXChroniclesWebURLKey;
extern NSString *const BXChroniclesFeedURLKey;
extern NSString *const BXFacebookURLKey;
extern NSString *const BXTwitterURLKey;
extern NSString *const BXAppStoreXMLURLKey;
extern NSString *const BXBoinxForumURLKey;
extern NSString *const TVOnlineHelpPageURL;
extern NSString *const TVOnlineHelpCreatingCustomLayersPageURL;
extern NSString *const TVOnlineHelpLayerProtocolPageURL;

extern NSString *const BXFastSpringURLKey;

// keys for Sparkle URLs
extern NSString * const SUAppcastFeedURLKey;
extern NSString * const SUAppcastBetaFeedURLKey;
extern NSString * const SUAppcastNightlyFeedURLKey;
extern NSString * const SUPlusAppcastFeedULRKey;

// License generation form urls
extern NSString *const BXGetDemoLicenseFormURLKey;
extern NSString *const BXGetFreeLicenseFormURLKey;
extern NSString *const BXRegisterLicenseFormURLKey;

// keys for Sales Assistant Data
extern NSString *const BXSalesConfigurationURLKey;	// decprecated
extern NSString *const BXSalesConfigurationStoreFileNameKey;	// decprecated
extern NSString *const BXSalesConfigurationStoreFileExtensionKey;	// decprecated

extern NSString * const BXSalesDataServerURLKey;
extern NSString * const BXSalesDataFileNameKey;
extern NSString * const BXSalesDataFileExtensionKey;

// Keys for licensing URLs (toplevel - OLD!)
extern NSString *const BXDemoLicenseURLKey;
extern NSString *const BXBuyLicenseURLKey;
extern NSString *const BXUpgradeLicenseURLKey;

// Feedback Assistant
extern NSString * const BXFeedbackAssistantFormURL;

// Keys for licensting URL (locale specific)
extern NSString *const BXSalesConfigurationsKey;
// Subkeys
extern NSString *const BXSalesConfigLocalesKey;

extern NSString *const BXSalesConfigPartnerLogoURLKey;

extern NSString *const BXSalesConfigBuyKRMEnabledKey;
extern NSString *const BXSalesConfigBuyWebEnabledKey;
extern NSString *const BXSalesConfigOptionsDemoEnabledKey;
extern NSString *const BXSalesConfigOptionsOtherEnabledKey;

extern NSString *const BXSalesConfigBuyKRMTitleKey;
extern NSString *const BXSalesConfigBuyWebTitleKey;
extern NSString *const BXSalesConfigOptionsDemoTitleKey;
extern NSString *const BXSalesConfigOptionsOtherTitleKey;

extern NSString *const BXSalesConfigBuyKRMDescriptionKey;
extern NSString *const BXSalesConfigBuyWebDescriptionKey;
extern NSString *const BXSalesConfigOptionsDemoDescriptionKey;
extern NSString *const BXSalesConfigOptionsOtherDescriptionKey;

extern NSString *const BXSalesConfigBuyWebURLKey;
extern NSString *const BXSalesConfigOptionsDemoURLKey;
extern NSString *const BXSalesConfigOptionsOtherURLKey;

// Keys for  version testing
extern NSString *const BXReleaseBundleVersionKey;
extern NSString *const BXReleaseInternalVersionKey;
extern NSString *const BXReleaseNewFeaturesKey;
extern NSString *const BXReleaseDownloadURLKey;


// Keys for beta version testing
extern NSString *const BXBetaBundleVersionKey;
extern NSString *const BXBetaInternalVersionKey;
extern NSString *const BXBetaNewFeaturesKey;
extern NSString *const BXBetaDownloadURLKey;


// Keys for Kagi Registration Module
extern NSString *const BXKRMConfigurationDictKey;
//Subkeys
extern NSString *const BXKRMConfigurationBaseCurrencyKey;
extern NSString *const BXKRMConfigurationBasePriceKey;
extern NSString *const BXKRMConfigurationVendorIDKey;
extern NSString *const BXKRMConfigurationProductIDKey;
extern NSString *const BXKRMConfigurationProductNameKey;
extern NSString *const BXKRMConfigurationSupportedCurrenciesKey;
extern NSString *const BXKRMConfigurationDetailedInformationURLKey;
extern NSString *const BXKRMConfigurationDescriptionKey;
extern NSString *const BXKRMConfigurationConnectionFailureURLKey;
extern NSString *const BXKRMConfigurationTransactionFailureURLKey;

// Keys for FastSpring sales (also with landing page at boinx.com)
extern NSString *const BXUpsale1to1RemoteCoaching;

// E-mail Addresses
extern NSString *const BXRegistrationFailureMail;
extern NSString * const BXFeedbackFailureMail;

// Keys for extended demo assistant
extern NSString * const BXExtendedDemoLongPeriodeKey;

@interface BXOnlineDefaults : NSObject {
    NSDictionary *_defaults;
	NSDictionary *_applicationDefaults;
	NSArray *_localeDefaults;	// holds NSDictonaries with localized versions of some keys
	NSURL *_connectionURL;
	NSOperationQueue *_downloadQueue;
	
	@private
		BOOL _online;
		BOOL _loaded;
		BOOL _inLibrary;
		
}

@property (retain, readonly) NSDictionary *defaults;

@property (assign, readonly, getter = isOnline) BOOL online;
@property (assign, readonly, getter = isLoaded) BOOL loaded;

#pragma mark -
#pragma mark class methods

+ (id) sharedDefaults;

#pragma mark -
#pragma mark handling connection data
- (NSString *) connectedHost;

#pragma mark -
#pragma mark opening urls

- (void) openURLForKey:(id)inKey;

#pragma mark -
#pragma mark accessing values

- (id) objectForKey:(id)inKey;
- (BOOL) boolForKey:(id)inKey;
- (NSURL *) URLForKey:(id)inKey;

#pragma mark -
#pragma mark Menu Item

- (NSMenuItem *)menuItemForURLKey:(NSString *)inKey;
- (NSMenuItem *)menuItemForKey:(NSString *)inKey action:(SEL)inSelector;
- (IBAction)openURLForMenuItem:(id)inSender;

#pragma mark -
#pragma mark accessing locale values

// what is this for? Old sales data?
- (NSURL *) localeURLForKey:(id)inKey;
- (NSString *)currentUserLocale;
- (NSDictionary *) defaultsForLocale:(NSString *)inLocale;

// new locale support
- (id)objectForKey:(NSString *)inKey ofLocale:(NSString *)inLocaleName;
- (id)objectForKeyOfCurrentLocale:(NSString *)inKey;

- (BOOL)boolForKey:(NSString *)inKey ofLocale:(NSString *)inLocaleName;
- (BOOL)boolForKeyOfCurrentLocale:(NSString *)inKey;

- (NSURL *)URLForKey:(NSString *)inKey ofLocale:(NSString *)inLocaleName;
- (NSURL *)URLForKeyOfCurrentLocale:(NSString *)inKey;

@end
