export type UNComponentsError = {
  errors: UNComponentsErrorData[]
}

export type UNComponentsErrorData = {
  status?: string,
  title: string,
  detail?: string,
  details?: string,
  meta?: UNComponentsErrorMeta
  code?: UNComponentsErrorCodes,
  error?: Error
}

interface UNComponentsErrorMeta {
  meta: Record<string, string>,
}

export enum UNComponentsErrorCodes {
  FEATURE_DISABLED = 'feature_disabled',
  INVALID_VALUE = 'invalid_value',
  LIMITS_EXCEEDED = 'limits_exceeded',
  NOT_FOUND = 'not_found',
  ACCOUNT_CUSTOMER_MISMATCH = 'account_customer_mismatch',
  NOT_SUPPORTED_FOR_ACCOUNT_STATUS = 'not_supported_for_account_status',
  NOT_SUPPORTED_FOR_ACCOUNT_TYPE = 'not_supported_for_account_type',
  NOT_SUPPORTED_FOR_CARD = 'not_supported_for_card',
  NOT_SUPPORTED_FOR_CARD_STATUS = 'not_supported_for_card_status',
  NOT_SUPPORTED_FOR_CARD_TYPE = 'not_supported_for_card_type',
  INVALID_NONCE = 'invalid_nonce',
  NOT_SUPPORTED_FOR_PAYMENT_TYPE = 'not_supported_for_payment_type',
  PAYMENT_INVALID = 'payment_invalid',
  UNAUTHORIZED = 'unauthorized',
  FORBIDDEN = 'forbidden',
  ALREADY_EXISTS = 'already_exists',
  CUSTOMER_NAME_UNDELIVERABLE = 'customer_name_undeliverable',
  CUSTOMER_ADDRESS_UNDELIVERABLE = 'customer_address_undeliverable',
  MISSING_TOKEN = 'missing_token'
}
