import { Result, ErrorResult, ResultError, ResultOk } from './custom_type_guard.cjs';
import { DeepPartial, AnyObject } from './types/custom_type.types.cjs';
import { ZodValidatorShape, ZodValidatorParsed, ZodValidatorSchemaRules } from './types/zod.types.cjs';

declare type OptionalKeys<T> = {
    [K in keyof T]-?: {} extends Pick<T, K> ? K : never;
}[keyof T];
declare type FlipOptional<T> = (Required<Pick<T, OptionalKeys<T>>> & Partial<Omit<T, OptionalKeys<T>>>) extends infer O ? {
    [K in keyof O]: O[K];
} : never;
declare type Rules<I> = FlipOptional<{
    [K in keyof I]: boolean;
}>;
declare type ExpectedResult<I, R extends Rules<I>> = {
    [K in keyof Required<(Rules<I> | I)>]: R extends Record<string, never> ? NonNullable<I[K]> : R[K] extends false ? DeepPartial<I[K]> | undefined : I[K] extends AnyObject ? NonNullable<DeepPartial<I[K]>> : NonNullable<I[K]>;
};
declare type RulesInverted<I> = Partial<{
    [K in keyof I]: boolean;
}>;
declare type ExpectedResultInverted<I, R extends RulesInverted<I>> = {
    [K in keyof Required<(RulesInverted<I> | I)>]: R extends Record<string, never> ? I[K] : R[K] extends true ? I[K] extends AnyObject ? NonNullable<DeepPartial<I[K]>> : NonNullable<I[K]> : DeepPartial<I[K]> | undefined;
};
declare const modelValidator: <I extends AnyObject = AnyObject, R extends FlipOptional<{ [K in keyof I]: boolean; }> = FlipOptional<{ [K in keyof I]: boolean; }>>(input: I, rules?: R) => Result<ExpectedResult<I, R>, ErrorResult>;
declare const modelValidatorTruths: <I extends AnyObject = AnyObject, R extends FlipOptional<{ [K in keyof I]: boolean; }> = FlipOptional<{ [K in keyof I]: boolean; }>>(notSure: unknown, model: new (...arguments_: any[]) => I, rules?: R) => notSure is I;
declare const modelValidatorInverted: <I extends AnyObject = AnyObject, R extends Partial<{ [K in keyof I]: boolean; }> = Partial<{ [K in keyof I]: boolean; }>>(input: I, rules?: R) => Result<ExpectedResultInverted<I, R>, ErrorResult>;
declare const zodModelValidator: <InputModel extends AnyObject = never>(model?: InputModel | (new (...arguments_: any[]) => InputModel) | undefined) => {
    rules: <SchemaRules extends ZodValidatorShape<InputModel> = ZodValidatorShape<InputModel>>(schemaRules: SchemaRules) => {
        validate(input: unknown): ResultError<ErrorResult> | ResultOk<ZodValidatorParsed<SchemaRules>>;
        schemaRules: ZodValidatorSchemaRules<SchemaRules>;
        model: InputModel | (new (...arguments_: any[]) => InputModel) | undefined;
    };
};

export { ExpectedResult, ExpectedResultInverted, Rules, RulesInverted, modelValidator, modelValidatorInverted, modelValidatorTruths, zodModelValidator };
