
import { ColorMode, ScaleMode, StyleProps } from "../types/dist/index.js";
import { StylePropsVariantsAuto } from "../automated-config/dist/generated/autoVariants.js";

//#region src/styles/stylerTypes.d.ts
type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
type CvaStyleValue<T> = T | CvaStyleArray<T> | Record<string, unknown> | null | boolean | undefined;
type CvaStyleArray<T> = CvaStyleValue<T>[];
type CVAVariantSchema<T, V extends CVAVariantShape<T>> = { [Variant in keyof V]?: StringToBoolean<keyof V[Variant]> | undefined };
type CVAVariantShape<T> = Record<string, Record<string, T>>;
type CVAStyleProp<T> = T extends string ? {
  className?: T;
} : {
  style?: T;
};
type CVAConfigBase<T> = {
  base?: T | null;
};
interface CVA<T> {
  <V extends CVAVariantShape<T>>(config: V extends CVAVariantShape<T> ? CVAConfigBase<T> & {
    base?: T;
    variants?: V;
    compoundVariants?: (V extends CVAVariantShape<T> ? (CVAVariantSchema<T, V> | { [Variant in keyof V]?: StringToBoolean<keyof V[Variant]> | undefined }) & CVAStyleProp<T> : CVAStyleProp<T>)[];
    defaultVariants?: CVAVariantSchema<T, V>;
  } : CVAConfigBase<T> & {
    variants?: never;
    compoundVariants?: never;
    defaultVariants?: never;
  }): (props?: V extends CVAVariantShape<T> ? CVAVariantSchema<T, V> & CVAStyleProp<T> : CVAStyleProp<T>) => T;
}
interface CX<T> {
  (...inputs: CvaStyleValue<T>[]): T;
}
type StylePropsVariants<ReturnType> = { [key in keyof Required<StyleProps>]: Record<Exclude<`${StyleProps[key]}`, 'undefined' | 'false'>, ReturnType> } & {
  colorMode: Record<ColorMode, string>;
  scaleMode: Record<ScaleMode, string>;
} & StylePropsVariantsAuto<ReturnType>;
//#endregion
export { type CVA, type CX, type StylePropsVariants };