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

import { type Client, formDataBodySerializer, type Options as Options2, type TDataShape } from './client';
import { client } from './client.gen';
import type { AnimationsApiPuzzleResultsData, AnimationsApiPuzzleResultsResponses, AnimationsApiResultsData, AnimationsApiResultsResponses, AnimationsApiTopSubmissionsData, AnimationsApiTopSubmissionsResponses, GamesApiListGamesData, GamesApiListGamesResponses, MarketApiCloseMarketData, MarketApiCloseMarketResponses, MarketApiCreateBetData, MarketApiCreateBetResponses, MarketApiListMarketsData, MarketApiListMarketsResponses, MarketApiListUserBetsData, MarketApiListUserBetsResponses, MarketApiResolveMarketData, MarketApiResolveMarketResponses, NoitaApiGetLeaderboardData, NoitaApiGetLeaderboardResponses, NoitaApiGetResultsData, NoitaApiGetResultsResponses, NoitaApiSubmitLogFileData, NoitaApiSubmitLogFileErrors, NoitaApiSubmitLogFileResponses, PolylanSubmitterApiClearCacheData, PolylanSubmitterApiClearCacheResponses, PolylanSubmitterApiGetUserInfoData, PolylanSubmitterApiGetUserInfoResponses, PolylanSubmitterApiHealthCheckData, PolylanSubmitterApiHealthCheckResponses, SubmissionsApiCreateSubmissionData, SubmissionsApiCreateSubmissionResponses, SubmissionsApiDeleteSubmissionData, SubmissionsApiDeleteSubmissionResponses, SubmissionsApiGetCollectionData, SubmissionsApiGetCollectionResponses, SubmissionsApiGetStatsData, SubmissionsApiGetStatsResponses, SubmissionsApiGetSubmissionData, SubmissionsApiGetSubmissionResponses, SubmissionsApiListPuzzlesData, SubmissionsApiListPuzzlesResponses, SubmissionsApiListResponsesNeedingValidationData, SubmissionsApiListResponsesNeedingValidationResponses, SubmissionsApiListSubmissionsData, SubmissionsApiListSubmissionsResponses, SubmissionsApiValidateAutoData, SubmissionsApiValidateAutoResponses, SubmissionsApiValidateResponseData, SubmissionsApiValidateResponseResponses, SubmissionsApiValidateSubmissionData, SubmissionsApiValidateSubmissionResponses } from './types.gen';

export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
    /**
     * 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>;
};

/**
 * Health Check
 *
 * Health check endpoint
 */
export const polylanSubmitterApiHealthCheck = <ThrowOnError extends boolean = false>(options?: Options<PolylanSubmitterApiHealthCheckData, ThrowOnError>) => (options?.client ?? client).get<PolylanSubmitterApiHealthCheckResponses, unknown, ThrowOnError>({ url: '/api/health', ...options });

/**
 * Clear Cache
 *
 * Clear all API caches (admin only)
 */
export const polylanSubmitterApiClearCache = <ThrowOnError extends boolean = false>(options?: Options<PolylanSubmitterApiClearCacheData, ThrowOnError>) => (options?.client ?? client).post<PolylanSubmitterApiClearCacheResponses, unknown, ThrowOnError>({ url: '/api/cache/clear', ...options });

/**
 * Get User Info
 *
 * Get current user information
 */
export const polylanSubmitterApiGetUserInfo = <ThrowOnError extends boolean = false>(options?: Options<PolylanSubmitterApiGetUserInfoData, ThrowOnError>) => (options?.client ?? client).get<PolylanSubmitterApiGetUserInfoResponses, unknown, ThrowOnError>({ url: '/api/user', ...options });

/**
 * List Puzzles
 *
 * Get list of available puzzles
 */
export const submissionsApiListPuzzles = <ThrowOnError extends boolean = false>(options?: Options<SubmissionsApiListPuzzlesData, ThrowOnError>) => (options?.client ?? client).get<SubmissionsApiListPuzzlesResponses, unknown, ThrowOnError>({ url: '/api/submissions/puzzles', ...options });

/**
 * Get Collection
 *
 * Get the active collection details
 */
export const submissionsApiGetCollection = <ThrowOnError extends boolean = false>(options?: Options<SubmissionsApiGetCollectionData, ThrowOnError>) => (options?.client ?? client).get<SubmissionsApiGetCollectionResponses, unknown, ThrowOnError>({ url: '/api/submissions/collection', ...options });

/**
 * List Submissions
 *
 * Get paginated list of submissions
 */
export const submissionsApiListSubmissions = <ThrowOnError extends boolean = false>(options?: Options<SubmissionsApiListSubmissionsData, ThrowOnError>) => (options?.client ?? client).get<SubmissionsApiListSubmissionsResponses, unknown, ThrowOnError>({ url: '/api/submissions/submissions', ...options });

/**
 * Create Submission
 *
 * Create a new submission with multiple puzzle responses
 */
export const submissionsApiCreateSubmission = <ThrowOnError extends boolean = false>(options: Options<SubmissionsApiCreateSubmissionData, ThrowOnError>) => (options.client ?? client).post<SubmissionsApiCreateSubmissionResponses, unknown, ThrowOnError>({
    ...formDataBodySerializer,
    url: '/api/submissions/submissions',
    ...options,
    headers: {
        'Content-Type': null,
        ...options.headers
    }
});

/**
 * Delete Submission
 *
 * Delete a submission (admin only)
 */
export const submissionsApiDeleteSubmission = <ThrowOnError extends boolean = false>(options: Options<SubmissionsApiDeleteSubmissionData, ThrowOnError>) => (options.client ?? client).delete<SubmissionsApiDeleteSubmissionResponses, unknown, ThrowOnError>({ url: '/api/submissions/submissions/{submission_id}', ...options });

/**
 * Get Submission
 *
 * Get detailed submission by ID
 */
export const submissionsApiGetSubmission = <ThrowOnError extends boolean = false>(options: Options<SubmissionsApiGetSubmissionData, ThrowOnError>) => (options.client ?? client).get<SubmissionsApiGetSubmissionResponses, unknown, ThrowOnError>({ url: '/api/submissions/submissions/{submission_id}', ...options });

/**
 * Validate Response
 *
 * Manually validate a puzzle response
 */
export const submissionsApiValidateResponse = <ThrowOnError extends boolean = false>(options: Options<SubmissionsApiValidateResponseData, ThrowOnError>) => (options.client ?? client).put<SubmissionsApiValidateResponseResponses, unknown, ThrowOnError>({
    url: '/api/submissions/responses/{response_id}/validate',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

/**
 * Validate Auto
 *
 * Try to auto validate a puzzle response
 */
export const submissionsApiValidateAuto = <ThrowOnError extends boolean = false>(options: Options<SubmissionsApiValidateAutoData, ThrowOnError>) => (options.client ?? client).put<SubmissionsApiValidateAutoResponses, unknown, ThrowOnError>({ url: '/api/submissions/responses/{response_id}/validate/auto', ...options });

/**
 * List Responses Needing Validation
 *
 * Get all responses that need manual validation
 */
export const submissionsApiListResponsesNeedingValidation = <ThrowOnError extends boolean = false>(options?: Options<SubmissionsApiListResponsesNeedingValidationData, ThrowOnError>) => (options?.client ?? client).get<SubmissionsApiListResponsesNeedingValidationResponses, unknown, ThrowOnError>({ url: '/api/submissions/responses/needs-validation', ...options });

/**
 * Validate Submission
 *
 * Mark entire submission as validated
 */
export const submissionsApiValidateSubmission = <ThrowOnError extends boolean = false>(options: Options<SubmissionsApiValidateSubmissionData, ThrowOnError>) => (options.client ?? client).post<SubmissionsApiValidateSubmissionResponses, unknown, ThrowOnError>({ url: '/api/submissions/submissions/{submission_id}/validate', ...options });

/**
 * Get Stats
 *
 * Get submission statistics
 */
export const submissionsApiGetStats = <ThrowOnError extends boolean = false>(options?: Options<SubmissionsApiGetStatsData, ThrowOnError>) => (options?.client ?? client).get<SubmissionsApiGetStatsResponses, unknown, ThrowOnError>({ url: '/api/submissions/stats', ...options });

/**
 * Results
 */
export const animationsApiResults = <ThrowOnError extends boolean = false>(options?: Options<AnimationsApiResultsData, ThrowOnError>) => (options?.client ?? client).get<AnimationsApiResultsResponses, unknown, ThrowOnError>({ url: '/api/results/results', ...options });

/**
 * Top Submissions
 *
 * Get tournament top submissions for each puzzle. Only available when tournament is closed.
 */
export const animationsApiTopSubmissions = <ThrowOnError extends boolean = false>(options?: Options<AnimationsApiTopSubmissionsData, ThrowOnError>) => (options?.client ?? client).get<AnimationsApiTopSubmissionsResponses, unknown, ThrowOnError>({ url: '/api/results/top-submissions', ...options });

/**
 * Puzzle Results
 *
 * Get tournament results organized by puzzle with coefficients. Only available when tournament is closed.
 */
export const animationsApiPuzzleResults = <ThrowOnError extends boolean = false>(options?: Options<AnimationsApiPuzzleResultsData, ThrowOnError>) => (options?.client ?? client).get<AnimationsApiPuzzleResultsResponses, unknown, ThrowOnError>({ url: '/api/results/puzzle-results', ...options });

/**
 * Get Results
 */
export const noitaApiGetResults = <ThrowOnError extends boolean = false>(options?: Options<NoitaApiGetResultsData, ThrowOnError>) => (options?.client ?? client).get<NoitaApiGetResultsResponses, unknown, ThrowOnError>({ url: '/api/noita/results', ...options });

/**
 * Get Leaderboard
 *
 * Get the global leaderboard for all users ranked by total score.
 *
 * Uses Window functions to rank users by their total score in descending order.
 */
export const noitaApiGetLeaderboard = <ThrowOnError extends boolean = false>(options?: Options<NoitaApiGetLeaderboardData, ThrowOnError>) => (options?.client ?? client).get<NoitaApiGetLeaderboardResponses, unknown, ThrowOnError>({ url: '/api/noita/leaderboard', ...options });

/**
 * Submit Log File
 *
 * Submit a Noita run file (log file, screenshot, or video).
 *
 * Accepts:
 * - Text files (.txt) for polylan_mod_log.txt
 * - Images (.png, .jpg, .gif)
 * - Videos (.mp4, .webm)
 *
 * Max file size: 256 MB
 */
export const noitaApiSubmitLogFile = <ThrowOnError extends boolean = false>(options: Options<NoitaApiSubmitLogFileData, ThrowOnError>) => (options.client ?? client).post<NoitaApiSubmitLogFileResponses, NoitaApiSubmitLogFileErrors, ThrowOnError>({
    ...formDataBodySerializer,
    url: '/api/noita/submit',
    ...options,
    headers: {
        'Content-Type': null,
        ...options.headers
    }
});

/**
 * List Games
 */
export const gamesApiListGames = <ThrowOnError extends boolean = false>(options?: Options<GamesApiListGamesData, ThrowOnError>) => (options?.client ?? client).get<GamesApiListGamesResponses, unknown, ThrowOnError>({ url: '/api/games/', ...options });

/**
 * List Markets
 *
 * List all markets (excludes draft markets).
 */
export const marketApiListMarkets = <ThrowOnError extends boolean = false>(options?: Options<MarketApiListMarketsData, ThrowOnError>) => (options?.client ?? client).get<MarketApiListMarketsResponses, unknown, ThrowOnError>({ url: '/api/market/', ...options });

/**
 * List User Bets
 *
 * List all bets placed by the current user.
 */
export const marketApiListUserBets = <ThrowOnError extends boolean = false>(options?: Options<MarketApiListUserBetsData, ThrowOnError>) => (options?.client ?? client).get<MarketApiListUserBetsResponses, unknown, ThrowOnError>({ url: '/api/market/user/bets', ...options });

/**
 * Close Market
 *
 * Close a market. Admin only.
 */
export const marketApiCloseMarket = <ThrowOnError extends boolean = false>(options: Options<MarketApiCloseMarketData, ThrowOnError>) => (options.client ?? client).post<MarketApiCloseMarketResponses, unknown, ThrowOnError>({ url: '/api/market/{market_uuid}/actions/close', ...options });

/**
 * Resolve Market
 *
 * Resolve a market with a winning option. Admin only.
 */
export const marketApiResolveMarket = <ThrowOnError extends boolean = false>(options: Options<MarketApiResolveMarketData, ThrowOnError>) => (options.client ?? client).post<MarketApiResolveMarketResponses, unknown, ThrowOnError>({
    url: '/api/market/{market_uuid}/actions/resolve',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

/**
 * Create Bet
 *
 * Place a bet on a market option.
 */
export const marketApiCreateBet = <ThrowOnError extends boolean = false>(options: Options<MarketApiCreateBetData, ThrowOnError>) => (options.client ?? client).post<MarketApiCreateBetResponses, unknown, ThrowOnError>({
    url: '/api/market/{market_uuid}/bets',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});
