//import {ThemeMode} from './appVar';

//export type EMail = string;

export type langCode = 'en' | string;

export type timestamp = number;

export type AccountName = string;
export type Username = string | undefined;
export type Password = string;
export type UserAgent = string;
export type XToken = string;
//export type verifyId = string;

export type XAuthorization = string;
//export type UserId = string;
//export type WebSocketSessionId = string;

export type EventId = string;

export const accountNameOptions = {
  minLength: 4,
  maxLength: 24,
  isAllowed: (text: string): boolean => {
    // allows usernames that start and end with a lowercase letter or digit, with optional dots or underscores in the middle, and it is case-insensitive
    return text.match(/^[a-z0-9](?:[._]*[a-z0-9])*$/i) !== null;
  },
};

export const userNameOptions = {
  minLength: 2,
  maxLength: 24,
  isAllowed: (text: string): boolean => {
    return true;
  },
};

export const passwordOptions = {
  minLength: 6,
  maxLength: 64,
  minBits: 50,
  isAllowed: (text: string): boolean => {
    // return /\W/.test(text) && /[a-zA-Z]/.test(text) && /[a-zA-Z]/.test(text);

    /*
    Contains at least one uppercase letter
    Contains at least one lowercase letter
    Contains at least one digit (number)
    Contains at least one special character
   */
    return /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+={}\[\]|;:'",.<>\/?]).*$/.test(
      text,
    );
  },
};

/*
export const emailOptions = {
  maxLength: 48,
  isAllowed: (email: string) => {
    return String(email).match(
      /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
    );
  },
}; */
