import { status } from '@synnaxlabs/x';
import { default as z } from 'zod';
import { state } from '../state';
export type InitialStatusDetailsContainer<StatusDetails extends z.ZodType = z.ZodNever> = [StatusDetails] extends [z.ZodNever] ? {} : {
    initialStatusDetails: z.output<StatusDetails>;
};
export declare const parseInitialStatusDetails: <StatusDetails extends z.ZodType = z.ZodNever>(container: InitialStatusDetailsContainer<StatusDetails>) => z.output<StatusDetails>;
export declare const resultStatusDetails: <Data extends state.State, StatusDetails extends z.ZodType = z.ZodNever>(result: Result<Data, StatusDetails>) => z.output<StatusDetails>;
export type ResultStatus<StatusDetails extends z.ZodType = z.ZodNever> = status.Status<StatusDetails, "success"> | status.Status<StatusDetails, "loading"> | status.Status<StatusDetails, "disabled"> | status.Status<typeof status.exceptionDetailsSchema, "error">;
export interface ErrorResult {
    variant: "error";
    status: status.Status<typeof status.exceptionDetailsSchema, "error">;
    data: undefined;
}
export type SuccessResult<Data extends state.State, StatusDetails extends z.ZodType = z.ZodNever> = {
    variant: "success";
    status: status.Status<StatusDetails, "success">;
    data: Data;
};
export type LoadingResult<Data extends state.State, StatusDetails extends z.ZodType = z.ZodNever> = {
    variant: "loading";
    status: status.Status<StatusDetails, "loading">;
    data: Data | undefined;
};
export type DisabledResult<Data extends state.State, StatusDetails extends z.ZodType = z.ZodNever> = {
    variant: "disabled";
    status: status.Status<StatusDetails, "disabled">;
    data: Data | undefined;
};
export type Result<Data extends state.State, StatusDetails extends z.ZodType = z.ZodNever> = ErrorResult | SuccessResult<Data, StatusDetails> | LoadingResult<Data, StatusDetails> | DisabledResult<Data, StatusDetails>;
interface ResultCreator {
    <Data extends state.State>(op: string, data?: Data | undefined): Result<Data, never>;
    <Data extends state.State, StatusDetails extends z.ZodType = z.ZodNever>(op: string, data: Data | undefined, statusDetails: z.output<StatusDetails>): Result<Data, StatusDetails>;
}
export declare const loadingResult: ResultCreator;
export declare const successResult: ResultCreator;
export declare const errorResult: (op: string, error: unknown) => ErrorResult;
interface NullClientResultCreator {
    <Data extends state.State>(op: string): DisabledResult<Data, never>;
    <Data extends state.State, StatusDetails extends z.ZodType = z.ZodNever>(op: string, statusDetails: z.output<StatusDetails>): DisabledResult<Data, StatusDetails>;
}
export declare const nullClientResult: NullClientResultCreator;
export {};
//# sourceMappingURL=result.d.ts.map