import { ZodSchemaType } from './types';

export const ZOD_SCHEMAS = [
  'any',
  'array',
  'bigint',
  'boolean',
  'custom',
  'date',
  'discriminatedUnion',
  'enum',
  'instanceof',
  'intersection',
  'literal',
  'nan',
  'nativeEnum',
  'null',
  'nullable',
  'record',
  'map',
  'never',
  'number',
  'object',
  'optional',
  'set',
  'string',
  'symbol',
  'tuple',
  'undefined',
  'union',
  'unknown',
  'void',
] as const;

export const ZOD_SCHEMA_TO_TYPE: Record<
  (typeof ZOD_SCHEMAS)[number],
  ZodSchemaType
> = {
  any: 'none',
  array: 'length',
  bigint: 'value',
  boolean: 'value',
  custom: 'none',
  date: 'value',
  discriminatedUnion: 'none',
  enum: 'none',
  instanceof: 'none',
  intersection: 'none',
  literal: 'none',
  map: 'size',
  nan: 'none',
  nativeEnum: 'none',
  never: 'none',
  null: 'none',
  nullable: 'none',
  record: 'none',
  number: 'value',
  object: 'none',
  optional: 'none',
  set: 'size',
  string: 'length',
  symbol: 'none',
  tuple: 'none',
  undefined: 'none',
  union: 'none',
  unknown: 'none',
  void: 'none',
};

export const ZOD_VALUE_TYPE_SCHEMAS: readonly (typeof ZOD_SCHEMAS)[number][] = [
  'bigint',
  'date',
  'number',
];

export const ZOD_VALIDATORS = [
  'base64',
  'base64url',
  'cidr',
  'cuid',
  'cuid2',
  'date',
  'datetime',
  'describe',
  'duration',
  'email',
  'emoji',
  'endsWith',
  'finite',
  'includes',
  'int',
  'ip',
  'length',
  'jwt',
  'max',
  'min',
  'step',
  'multipleOf',
  'nanoid',
  'negative',
  'nonempty',
  'nonnegative',
  'nonpositive',
  'positive',
  'readonly',
  'regex',
  'safe',
  'size',
  'startsWith',
  'toLowerCase',
  'toUpperCase',
  'trim',
  'url',
  'gt',
  'gte',
  'lt',
  'lte',
  'time',
  'ulid',
  'uuid',
] as const;

export const ZOD_SCHEMA_PROPERTIES = [
  'element',
  'description',
  'shape',
] as const;

export const ZOD_RESULT_PROPERTIES = ['data', 'error'] as const;

export const ZOD_PROPERTIES = [
  ...ZOD_SCHEMA_PROPERTIES,
  ...ZOD_RESULT_PROPERTIES,
] as const;

export const ZOD_METHODS = [
  'array',
  'catchall',
  'default',
  'deepPartial',
  'exclude',
  'extend',
  'extract',
  'keyof',
  'omit',
  'optional',
  'or',
  'merge',
  'nullable',
  'nullish',
  'parse',
  'parseAsync',
  'partial',
  'passthrough',
  'pick',
  'refine',
  'required',
  'rest',
  'safeParse',
  'safeParseAsync',
  'strict',
  'strip',
  'spa',
  'transform',
  'unwrap',
] as const;

export const ZOD_TYPES = ['infer', 'input', 'output'] as const;
