export enum ProfileInputType {
  STRING = 'STRING',
  STRING_LIST = 'STRING_LIST',
  NUMBER_LIST = 'NUMBER_LIST',
  URL = 'URL',
  NUMBER = 'NUMBER',
  EMAIL = 'EMAIL',
  DATE = 'DATE',
  PHONE_NUMBER = 'PHONE_NUMBER',
  USER = 'USER',
  USER_LIST = 'USER_LIST',
  OPTION = 'OPTION',
  MULTIPLE_OPTION = 'MULTIPLE_OPTION',
}

type CommonProfileField = {
  name: string;
  label: string;
  id: string;
  required?: boolean;
  disableFuture?: boolean;
  helperText?: string;
  metadata?: { showCounter?: boolean };
};

export type WithSuggestions = CommonProfileField & {
  type: ProfileInputType.STRING_LIST | ProfileInputType.STRING;
  suggestions: string[];
};

export type WithOptions = CommonProfileField & {
  type: ProfileInputType.OPTION | ProfileInputType.MULTIPLE_OPTION;
  options: string[];
};

type SimpleProfileField = CommonProfileField & {
  type: Exclude<
    ProfileInputType,
    | ProfileInputType.STRING_LIST
    | ProfileInputType.STRING
    | ProfileInputType.OPTION
    | ProfileInputType.MULTIPLE_OPTION
  >;
};

export type ProfileInputField =
  | WithSuggestions
  | WithOptions
  | SimpleProfileField;
