import type { PageSearchParams } from '@/utils/request/types'
import { BooleanFlag, AuctionStatusEnum } from '@/constants'

export interface BackendAuctionListSearchParams extends PageSearchParams {
  name?: string
  status?: AuctionStatusEnum
  isDisplay?: BooleanFlag
}

export interface BackendAuctionListItemDto extends PageSearchParams {
  bidLimit: number
  canBid: number
  cannotBidReason: string
  createAt: number
  createUserName: string
  currentBidderId: number
  currentPrice: number
  description: string
  endTime: number
  id: number
  imageUrl: string
  isDisplay: number
  minIncrement: number
  name: string
  quantity: number
  specification: string
  startTime: number
  startingPrice: number
  status: AuctionStatusEnum
  statusDesc: string
  totalBids: number
  type: number
  typeDesc: string
  userBidCount: number
  // 拍卖剩余时间 几天 几个小时 几分钟 几秒
  remainingTime: string
}

export interface BackendDeleteAuctionDto {
  idList: number[]
  confirmDelete: boolean
}

export interface BackendAddOrUpdateAuctionItemDto {
  id?: number
  status?: AuctionStatusEnum
  name: string
  quantity: number
  specification: string
  description: string
  startingPrice: number
  minIncrement: number
  bidLimit: number
  startTime: string
  endTime: string
  isDisplay: BooleanFlag
  imageUrl: string
}

export interface BackendAuctionRecordItemDto extends PageSearchParams {
  id: number
  bidPrice: number
  bidTime: number
  isHighest: number
  itemId: number
  status: number
  userId: number
  userName: string
}

export interface BackendLotteryPrizeListSearchParams extends PageSearchParams {
  isCurrent?: BooleanFlag
}

export interface BackendLotteryPrizeListItemDto extends PageSearchParams {
  id: number
  name: string
}

export interface BackendAddOrUpdateLotteryPrizeDto {
  id?: number
  name: string
  isCurrent: BooleanFlag
  imageUrl: string
}

export interface BackendAddOrUpdateLotteryConfigDto {
  id?: number
  startDate: string
  endDate: string
  autoCloseWeekend: BooleanFlag
  registrationStartHour: string
  registrationEndHour: string
  registrationFee: number
}

export type BackendLotteryConfigDto = {
  autoCloseWeekend: BooleanFlag
  createdAt: number
  endDate: number
  id: number
  isJoin: BooleanFlag
  number: number
  prizesImg: string
  prizesName: string
  registrationEndHour: number
  registrationFee: number
  registrationStartHour: number
  startDate: number
  status: BooleanFlag
  updatedAt: number
  winner: number
  inRegistrationTime: BooleanFlag
  registrationTimeDesc: string
} | null

// ========== 大转盘抽奖 ==========

export interface BackendWheelPrizeListSearchParams extends PageSearchParams {
  name?: string
  isEnabled?: BooleanFlag
}

export interface BackendWheelPrizeListItemDto {
  id: number
  name: string
  imageUrl: string
  quantity: number
  probability: number
  isEnabled: BooleanFlag
  createdAt: number
}

export interface BackendAddOrUpdateWheelPrizeDto {
  id?: number
  name: string
  imageUrl: string
  quantity: number
  probability: number
  isEnabled: BooleanFlag
}

export type BackendWheelConfigDto = {
  isActivityActive: boolean
  startTime: number
  endTime: number
  costYaCoin: number
} | null

export interface BackendAddOrUpdateWheelConfigDto {
  costYaCoin: number
  startTime: string
  endTime: string
}
