export interface PlatformPaginationResult {
  page_num: number
  page_size: number
  total: number
}

export interface PlatformPageResult<T> {
  items: T[]
  page: PlatformPaginationResult
}

export interface SystemAdminPageFilters {
  keyword?: string
  page_num?: number
  page_size?: number
}

export interface AdminUserListFilters extends SystemAdminPageFilters {
  user_status?: string
}

export interface AdminRoleListFilters extends SystemAdminPageFilters {
  role_status?: string
}

export interface AdminMenuListFilters extends SystemAdminPageFilters {
  menu_status?: string
}

export interface AdminHotelListFilters extends SystemAdminPageFilters {
  hotel_status?: string
}

export interface AdminUserRoleResult {
  id: string
  role_code: string
  role_name: string
  system_builtin: boolean
}

export interface AdminUserHotelResult {
  hotel_id: string
  hotel_name: string
  hotel_status: string | null
  default_hotel: boolean
}

export interface AdminUserListItemResult {
  id: string
  username: string
  display_name: string
  email: string | null
  phone: string | null
  user_status: string
  super_admin: boolean
  roles: AdminUserRoleResult[]
  default_hotel_id: string | null
  last_login_at: string | null
  updated_at: string | null
}

export interface AdminUserDetailResult extends AdminUserListItemResult {
  hotels: AdminUserHotelResult[]
  created_at: string | null
}

export interface AdminPermissionResult {
  id: string
  permission_code: string
  permission_name: string
  permission_group: string
  permission_status: string
  system_builtin: boolean
}

export interface AdminRoleListItemResult {
  id: string
  role_code: string
  role_name: string
  role_status: string
  system_builtin: boolean
  permission_count: number
  user_count: number
}

export interface AdminRoleDetailResult extends AdminRoleListItemResult {
  permissions: AdminPermissionResult[]
  created_at: string | null
  updated_at: string | null
}

export interface AdminMenuResult {
  id: string
  parent_id: string | null
  menu_code: string
  menu_name: string
  menu_type: string
  route_path: string | null
  component_key: string | null
  icon_key: string | null
  permission_code: string | null
  sort_order: number | null
  visible: boolean
  menu_status: string
  known_route: boolean
  created_at: string | null
  updated_at: string | null
}

export interface AdminHotelResult {
  id: string
  hotel_id: string
  hotel_name: string
  hotel_status: string
  time_zone: string
  sort_order: number | null
  authorized_user_count: number
  created_at: string | null
  updated_at: string | null
}

export interface AdminUserCreateRequest {
  username: string
  initial_password: string
  display_name: string
  email?: string
  phone?: string
  user_status: string
  role_ids: string[]
  hotel_ids: string[]
  default_hotel_id: string
}

export interface AdminUserUpdateRequest {
  display_name: string
  email?: string
  phone?: string
  user_status: string
}

export interface AdminUserRoleAssignmentRequest {
  role_ids: string[]
}

export interface AdminUserHotelAssignmentRequest {
  hotel_ids: string[]
  default_hotel_id: string
}

export interface AdminUserPasswordResetRequest {
  new_password?: string
}

export interface AdminUserPasswordResetResult {
  user_id: string
  username: string
  temporary_password: string
}

export interface AdminRoleCreateRequest {
  role_code: string
  role_name: string
  role_status: string
}

export interface AdminRoleUpdateRequest {
  role_name: string
  role_status: string
}

export interface AdminRolePermissionAssignmentRequest {
  permission_ids: string[]
}

export interface AdminMenuCreateRequest {
  parent_id?: string
  menu_code: string
  menu_name: string
  menu_type: string
  route_path?: string
  component_key?: string
  icon_key?: string
  permission_code?: string
  sort_order?: number
  visible: boolean
  menu_status: string
}

export interface AdminMenuUpdateRequest {
  parent_id?: string
  menu_name: string
  menu_type: string
  route_path?: string
  component_key?: string
  icon_key?: string
  permission_code?: string
  sort_order?: number
  visible: boolean
  menu_status: string
}

export interface AdminHotelCreateRequest {
  hotel_id: string
  hotel_name: string
  time_zone: string
  sort_order?: number
}

export interface AdminHotelUpdateRequest {
  hotel_name: string
  time_zone: string
  sort_order?: number
}

export interface AdminHotelStatusUpdateRequest {
  hotel_status: string
}

export interface AdminAuditLogListFilters extends SystemAdminPageFilters {
  target_type?: string
  target_id?: string
  action?: string
}

export interface AdminAuditLogResult {
  id: string
  actor_user_id: string
  actor_username: string
  actor_display_name: string
  target_type: string
  target_id: string
  action: string
  before_snapshot_json: string | null
  after_snapshot_json: string | null
  occurred_at: string
}
