interface ClientConfig {
	environment?: "sandbox" | "production";
	baseUrl?: string;
}

export class Client {
	private secret: string;
	private configs: ClientConfig;

	constructor(secret: string, configs: ClientConfig = {}) {
		this.secret = secret;
		this.configs = configs;
	}

	/**
	 * Not for use outside the SDK lib
	 */
	get _clientInfo() {
		return {
			secret: this.secret,
			configs: this.configs,
		};
	}

	get _url() {
		if (this.configs.baseUrl) {
			return this.configs.baseUrl;
		}

		if (this.configs.environment === 'production') {
			return 'https://api.event.dev';
		}

		//TODO: change this to sandbox

		return 'https://development-stream.event.dev';
	}
}

export const createClient = (secret: string, configs: ClientConfig = {}) => {
	return new Client(secret, configs);
};

