/**
* react-native-cloudwise.d.ts
*
* Type definition file for the react native cloudwise package
*/

export enum Platform {
	Android,
	Ios
}

export enum DataCollectionLevel {
	Off,
	User,
	Performance
}

export const Dynatrace: {
	/**
	 * Enter an action
	 * @param {string} actionName - name of action
	 * @param {Platform} platform - if empty default is both platforms
	 * @return id of created action
	 */
	enterAction(name: string, platform?: Platform): DynatraceAction;

	/**
	 * End a session
	 * @param {Platform} platform - if empty default is both platforms
	 */
	endSession(platform?: Platform): void;

	/**
	 * Identify the session with a user string
	 * @param {string} user - username which should be used for the session
	 * @param {Platform} platform - if empty default is both platforms
	 */
	identifyUser(user: string, platform?: Platform): void;

	/**
	 * Set the GPS Location of the device
	 * @param {Number} latitude - latitude of the position
	 * @param {Number} longitude - longitude of the position
	 * @param {Platform} platform - if empty default is both platforms
	 */
	setGPSLocation(latitude: Number, longitude: Number, platform?: Platform): void;

	/**
	 * Flush all events in db
	 * @param {Platform} platform - if empty default is both platforms
	 */
	flushEvents(platform?: Platform): void;

	/**
	 * Returns boolean value which tells you if crash reporting is turned on
	 * @param {Platform} platform - if empty default is both platforms
	 * @returns promise which resolves a boolean
	 */
	isCrashReportingOptedIn(platform?: Platform): Promise<boolean>;

	/**
	 * Set if crash reporting should be enabled or disabled
	 * @param {boolean} crashReporting - true => crash reporting enabled
	 * @param {Platform} platform - if empty default is both platforms
	 */
	setCrashReportingOptedIn(crashReporting: boolean, platform?: Platform): void;

	/**
	 * Get the current data collection level (off, user_behavior, performance)
	 * @param {Platform} platform - if empty default is both platforms
	 * @returns promise which resolve a data collection level string
	 */
	getDataCollectionLevel(platform?: Platform): Promise<DataCollectionLevel>;

	/**
	 * Set the data collection level (off, user_behavior, performance)
	 * @param {DataCollectionLevel} dataCollectionLevel - off, user_behavior, performance
	 * @param {Platform} platform - if empty default is both platforms
	 */
	setDataCollectionLevel(dataCollectionLevel: DataCollectionLevel, platform?: Platform): void;

	/**
	 * Report an error without an action
	 * @param {string} errorName - Name of the error event
	 * @param {number} errorCode - The code of the error
	 * @param {Platform} platform - if empty default is both platforms
	 */
	reportError(errorName: string, errorCode: number, platform?: Platform): void;

}

export declare class DynatraceAction {
	/**
	 * Report an error
	 * @param {string} errorName - Name of the error event
	 * @param {number} errorCode - The code of the error
	 * @param {Platform} platform - if empty default is both platforms
	 */
	reportError(errorName: string, errorCode: number, platform?: Platform): void;

	/**
	 * Report an event
	 * @param {string} eventName - Name of the event
	 * @param {Platform} platform - if empty default is both platforms
	 */
	reportEvent(eventName: string, platform?: Platform): void;

	/**
	 * Report a string value
	 * @param {string} valueName - Name of the value
	 * @param {string} value - The string value
	 * @param {Platform} platform - if empty default is both platforms
	 */
	reportStringValue(valueName: string, value: string, platform?: Platform): void;

	/**
	 * Report a int value
	 * @param {string} valueName - Name of the value
	 * @param {Number} value - The int value
	 * @param {Platform} platform - if empty default is both platforms
	 */
	reportIntValue(valueName: string, value: Number, platform?: Platform): void;

	/**
	 * Report a double value
	 * @param {string} valueName - Name of the value
	 * @param {Number} value - The double value
	 * @param {Platform} platform - if empty default is both platforms
	 */
	reportDoubleValue(valueName: string, value: Number, platform?: Platform): void;

	/**
	 * Leave action
	 * @param {Platform} platform - if empty default is both platforms
	 */
	leaveAction(platform?: Platform): void;
}
