// these types come from https://github.com/sindresorhus/type-fest/blob/main/source/internal.d.ts

import { Primitive } from './primitive';
import { Trim } from './trim';

/**
 * Matches any primitive, `void`, `Date`, or `RegExp` value.
 */
export type BuiltIns = Primitive | void | Date | RegExp;

/**
 * Matches non-recursive types.
 */
export type NonRecursiveType = BuiltIns | Function | (new (...arguments_: any[]) => unknown);

/**
 * Returns a boolean for whether the string is numeric.
 *
 * This type is a workaround for [Microsoft/TypeScript#46109](https://github.com/microsoft/TypeScript/issues/46109#issuecomment-930307987).
 */
export type IsNumeric<T extends string> = T extends `${number}`
  ? Trim<T> extends T
    ? true
    : false
  : false;

/**
 * Returns a boolean for whether the string is lowercased.
 */
export type IsLowerCase<T extends string> = T extends Lowercase<T> ? true : false;

/**
 * Returns a boolean for whether the string is upper-cased.
 */
export type IsUpperCase<T extends string> = T extends Uppercase<T> ? true : false;

export type WordSeparators = '-' | '_' | Whitespace;

export type Whitespace =
  | '\u{9}' // '\t'
  | '\u{A}' // '\n'
  | '\u{B}' // '\v'
  | '\u{C}' // '\f'
  | '\u{D}' // '\r'
  | '\u{20}' // ' '
  | '\u{85}'
  | '\u{A0}'
  | '\u{1680}'
  | '\u{2000}'
  | '\u{2001}'
  | '\u{2002}'
  | '\u{2003}'
  | '\u{2004}'
  | '\u{2005}'
  | '\u{2006}'
  | '\u{2007}'
  | '\u{2008}'
  | '\u{2009}'
  | '\u{200A}'
  | '\u{2028}'
  | '\u{2029}'
  | '\u{202F}'
  | '\u{205F}'
  | '\u{3000}'
  | '\u{FEFF}';

export type UpperCaseCharacters =
  | 'A'
  | 'B'
  | 'C'
  | 'D'
  | 'E'
  | 'F'
  | 'G'
  | 'H'
  | 'I'
  | 'J'
  | 'K'
  | 'L'
  | 'M'
  | 'N'
  | 'O'
  | 'P'
  | 'Q'
  | 'R'
  | 'S'
  | 'T'
  | 'U'
  | 'V'
  | 'W'
  | 'X'
  | 'Y'
  | 'Z';
