import type { Address } from '@/modules/profile/types/address.types'
import type { Bank } from '@/modules/profile/types/bank.types'
import type { BankDetail } from '@/modules/profile/types/bankDetail.types'
import type { Employment } from '@/modules/profile/types/employment.types'
import type { Heir } from '@/modules/profile/types/heir.types'

export interface UserRole {
  id: string
  name: string
  guard_name: string
}

export interface UserBankDetail extends BankDetail {
  bank?: Bank | null
}

export interface UserListItem {
  id: string
  name: string
  email: string
  ic_number: string
  position: string
  phone_number: string
  image_url: string | null
  status: string
  deleted_at?: string | null
  roles: UserRole[]
  member_number?: number | null
}

export interface UserDetail {
  id: string
  name: string
  email: string
  ic_number: string
  position: string
  phone_number: string | null
  image_url: string | null
  status: string
  gender: string | null
  marriage_status: string | null
  member_number: number | null
  member_type: string | null
  join_date: string | null
  birth_date: string | null
  birth_place: string | null
  roles: UserRole[]
  addresses?: Address[]
  employments?: Employment[]
  bank_details?: UserBankDetail[]
  heirs?: Heir[]
}

export interface UpdateUserPayload {
  name: string
  ic_number: string
  position: string
  phone_number?: string | null
  status?: string | null
  gender?: string | null
  marriage_status?: string | null
  member_number?: number | null
  member_type?: string | null
  join_date?: string | null
  birth_date?: string | null
  birth_place?: string | null
}

export interface CreateUserPayload {
  name: string
  email: string
  ic_number: string
  position: string
  phone_number?: string | null
  status: string
  gender: string
  marriage_status: string
  member_number: number
  member_type: string
  join_date: string
  birth_date: string
  birth_place: string
}

export interface ListUsersParams {
  page: number
  per_page: number
  sort_by: string
  sort_order: string
  search?: string
  status?: string
}

export interface ListDeletedUsersParams {
  page: number
  per_page: number
  sort_by: string
  sort_order: string
  search?: string
  status?: string
}
