// This file is auto-generated by @hey-api/openapi-ts

import type { Options as ClientOptions, TDataShape, Client } from './client';
import type { PostAuthOtpRequestData, PostAuthOtpRequestResponses, PostAuthOtpRequestErrors, PostAuthOtpVerifyData, PostAuthOtpVerifyResponses, PostAuthOtpVerifyErrors, PostAuthConsentAcceptData, PostAuthConsentAcceptResponses, PostAuthConsentAcceptErrors } from './types.gen';
import { zPostAuthOtpRequestData, zPostAuthOtpRequestResponse, zPostAuthOtpVerifyData, zPostAuthOtpVerifyResponse, zPostAuthConsentAcceptData, zPostAuthConsentAcceptResponse } from './zod.gen';
import { client as _heyApiClient } from './client.gen';

export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
    /**
     * You can provide a client instance returned by `createClient()` instead of
     * individual options. This might be also useful if you want to implement a
     * custom client.
     */
    client?: Client;
    /**
     * You can pass arbitrary values through the `meta` object. This can be
     * used to access values that aren't defined as part of the SDK function.
     */
    meta?: Record<string, unknown>;
};

export class Auth {
    /**
     * Request OTP
     */
    public static postAuthOtpRequest<ThrowOnError extends boolean = false>(options: Options<PostAuthOtpRequestData, ThrowOnError>) {
        return (options.client ?? _heyApiClient).post<PostAuthOtpRequestResponses, PostAuthOtpRequestErrors, ThrowOnError>({
            requestValidator: async (data) => {
                return await zPostAuthOtpRequestData.parseAsync(data);
            },
            responseValidator: async (data) => {
                return await zPostAuthOtpRequestResponse.parseAsync(data);
            },
            url: '/auth/otp/request',
            ...options,
            headers: {
                'Content-Type': 'application/json',
                ...options.headers
            }
        });
    }
    
    /**
     * Verify OTP
     */
    public static postAuthOtpVerify<ThrowOnError extends boolean = false>(options: Options<PostAuthOtpVerifyData, ThrowOnError>) {
        return (options.client ?? _heyApiClient).post<PostAuthOtpVerifyResponses, PostAuthOtpVerifyErrors, ThrowOnError>({
            requestValidator: async (data) => {
                return await zPostAuthOtpVerifyData.parseAsync(data);
            },
            responseValidator: async (data) => {
                return await zPostAuthOtpVerifyResponse.parseAsync(data);
            },
            url: '/auth/otp/verify',
            ...options,
            headers: {
                'Content-Type': 'application/json',
                ...options.headers
            }
        });
    }
    
    /**
     * Accept consent
     */
    public static postAuthConsentAccept<ThrowOnError extends boolean = false>(options: Options<PostAuthConsentAcceptData, ThrowOnError>) {
        return (options.client ?? _heyApiClient).post<PostAuthConsentAcceptResponses, PostAuthConsentAcceptErrors, ThrowOnError>({
            requestValidator: async (data) => {
                return await zPostAuthConsentAcceptData.parseAsync(data);
            },
            responseValidator: async (data) => {
                return await zPostAuthConsentAcceptResponse.parseAsync(data);
            },
            url: '/auth/consent/accept',
            ...options,
            headers: {
                'Content-Type': 'application/json',
                ...options.headers
            }
        });
    }
}