export type AuthPermissionCode =
  | 'SOURCE_MESSAGE_READ'
  | 'SOURCE_MESSAGE_ORIGINAL_READ'
  | 'RESERVATION_ORDER_READ'
  | 'RESERVATION_TASK_READ'
  | 'RESERVATION_TASK_EDIT'
  | 'RESERVATION_TASK_CONFIRM'
  | 'RESERVATION_OPERA_SIM_EXECUTE'
  | 'RESERVATION_AUDIT_READ'
  | 'HOTEL_SWITCH'
  | 'SYSTEM_AUTH_READ'
  | 'SYSTEM_ADMIN_CONSOLE_ACCESS'
  | 'SYSTEM_USER_MANAGE'
  | 'SYSTEM_ROLE_MANAGE'
  | 'SYSTEM_MENU_MANAGE'
  | 'HOTEL_MANAGE'
  | 'SYSTEM_DEBUG_EML_RUN'
  | (string & {})

export interface AuthLoginRequest {
  username: string
  password: string
  preferred_hotel_id?: string
}

export interface AuthUserResult {
  id: string
  username: string
  display_name: string
  super_admin: boolean
}

export interface AuthHotelResult {
  hotel_id: string
  hotel_name: string
  time_zone: string
  default_hotel: boolean | null
}

export interface AuthMenuResult {
  menu_code: string
  menu_name: string
  route_path: string
  component_key: string | null
  icon_key: string | null
  permission_code: AuthPermissionCode | null
  sort_order: number | null
}

export interface AuthMeResult {
  user: AuthUserResult
  default_hotel_id: string | null
  hotels: AuthHotelResult[]
  permissions: AuthPermissionCode[]
  menus: AuthMenuResult[]
}

export interface AuthLoginResult extends AuthMeResult {
  access_token: string
  token_type: string
  expires_at: string
}

export interface AuthLogoutResult {
  success: boolean
}

export interface AuthErrorResponse {
  error_code?: string
  message?: string
}
