import type { EmptyObject } from '../../../Types';
import type { ModifierIdentifier, StateAtomIdentifier, StateAtomIdIdentifier } from './Symbols';
type AnyRecord = Record<string, any>;
type AnyFunction = (...args: any[]) => any;
type AnyModifier<Data = any> = (data: Data, ...parameters: any[]) => boolean;
type BoundModifier<M extends AnyModifier> = (unknown extends Parameters<M>[1] ? (parameter: void) => void : (...parameter: IgnoreFirstParam<M>) => boolean) & {
    [ModifierIdentifier]: StateAtom;
};
type IgnoreFirstParam<T extends AnyFunction> = Parameters<T> extends [unknown, ...infer R] ? R : [];
export type IsStateAtom<T> = T extends {
    [StateAtomIdentifier]: 10;
} ? true : false;
type IsFunction<T> = T extends AnyFunction ? true : false;
type DeepReadonlyStateAtom<T extends AnyRecord> = {
    readonly [K in keyof T]: IsStateAtom<T[K]> extends true ? T[K] : IsFunction<T[K]> extends true ? T[K] : T[K] extends AnyRecord ? DeepReadonlyStateAtom<T[K]> : T[K];
};
export type StateAtom<DataType extends EmptyObject = EmptyObject, Modifiers extends {
    [actionName: string]: AnyModifier<DataType>;
} = EmptyObject> = DeepReadonlyStateAtom<{
    [key in keyof DataType]: DataType[key];
}> & {
    [key in keyof Modifiers]: BoundModifier<Modifiers[key]>;
} & {
    [StateAtomIdentifier]: 10;
    [StateAtomIdIdentifier]: string;
};
export {};
