/**
 * Username/password login data. Username can also be the user's email.
 */
export interface UserPassword {
	username: string
	password: string
	acceptedLatestTos?: boolean
	organizerId?: string
}

export interface Jwt {
	token: string
}

/**
 * Body sent when requesting a new JWT via the refresh token
 */
export interface RefreshToken {
	refreshToken: string
	organizerId?: string
}

export interface RefreshableJwt extends Jwt, RefreshToken {}

/**
 * Used when authorized via OAuth. Token is provided by the third party.
 */
export interface ThirdPartyAuth {
	token: string
	thirdParty: OAuthProvider
	acceptedLatestTos?: boolean
	firstName?: string
	lastName?: string
}

/**
 * Response when authorized via OAuth. Token is provided by the third party.
 */
export interface ThirdPartyAuthResponse extends Jwt {
	refreshToken: string
}

/**
 * @param clientNonce a randomly generated nonce used to identify a sign-in attempt
 * @param enrollmentId from the wallet
 */
export interface WalletChallengeRequest {
	clientNonce: string
	enrollmentId: string
}

export interface Nonce {
	nonce: string
}

export interface SignedWalletChallenge {
	clientNonce: string
	signedNonce: string
	nonce: string
	organizerId?: string
}

export type ServiceNames = 'account' | 'email' | 'payment' | 'event'
export interface ServiceAccessData {
	name: string | ServiceNames
	password: string
	orgId: number
}

export enum OAuthProvider {
	Google = 'google',
	Facebook = 'facebook',
	Apple = 'apple',
}

export interface ImpersonateRequest {
	userId: number
	organizerId?: string
}
