export type AdminTaskBindingSummary = {
  totalBindingCount: number
  reservedBindingCount: number
  consumedBindingCount: number
  releasedBindingCount: number
  roleKeys: string[]
}

export type AdminAgisoAutoDeliveryStatus = {
  status: string
  trigger: string
  reason: string
  platformOrderId: string
  responseStatus: number
  errorMessage: string
  requestId: string
  updatedAt: string | null
}

export type AdminOrderListItem = {
  orderId: number
  provider: string
  platform: string
  shopId: string
  shopName: string
  platformOrderId: string
  orderStatus: string
  payStatus: string
  buyerId: string
  buyerName: string
  receiverContact: string
  totalAmount: string
  totalAmountFen: number
  currency: string
  paidAt: string | null
  createdAt: string
  updatedAt: string
  itemCount: number
  totalQuantity: number
  itemSummary: string
  taskCount: number
  systemBindingStatus: string
  userBindingStatus: string
  systemBoundTaskCount: number
  completedBindingTaskCount: number
  totalBindingCount: number
  reservedBindingCount: number
  consumedBindingCount: number
  releasedBindingCount: number
}

export type AdminTaskListItem = {
  taskId: number
  taskNo: string
  platformOrderId: string
  skuCode: string
  skuName: string
  status: string
  executorKey: string
  deliveryStatus: string
  resultCode: string
  resultMessage: string
  systemBindingStatus: string
  userBindingStatus: string
  loginType: string
  roleName: string
  roleId: string
  browserSessionId: string
  claimedAt: string | null
  roleConfirmedAt: string | null
  redeemedAt: string | null
  retryCount: number
  bindingSummary: AdminTaskBindingSummary
  lastError: string
  createdAt: string
  updatedAt: string
  inventoryDisplayMasked: string
  inventoryCredentialType: string
  claimToken: string
  screenshotPath: string
  agisoAutoDelivery: AdminAgisoAutoDeliveryStatus | null
}

export type AdminInventoryItemListItem = {
  inventoryItemId: number
  skuCode: string
  batchNo: string
  credentialType: string
  inventoryGroupCode: string
  displayValue: string
  status: string
  reservedByTaskId: number | null
  reservedByTaskNo: string
  platformOrderId: string
  systemBindingStatus: string
  userBindingStatus: string
  invalidReason: string
  deliveredAt: string | null
  createdAt: string
  updatedAt: string
}

export type AdminWebhookEventListItem = {
  eventId: number
  provider: string
  platform: string
  platformRaw: string
  shopId: string
  shopName: string
  eventType: string
  eventKey: string
  signatureValid: boolean
  processed: boolean
  processError: string
  visibilityLevel: string
  relatedOrderId: number | null
  platformOrderId: string
  buyerId: string
  buyerName: string
  totalAmount: string
  totalAmountFen: number
  currency: string
  itemCount: number
  taskCount: number
  messageText: string
  requestTimestamp: string
  requestSign: string
  aopic: string
  sourceHost: string
  sourceIp: string
  userAgent: string
  createdAt: string
  headers?: Record<string, unknown>
  query?: Record<string, unknown>
  body?: Record<string, unknown>
  payload?: Record<string, unknown>
}

export type AdminInventorySkuSuggestion = {
  skuCode: string
  credentialType: string
  inventoryGroupCode: string
  totalCount: number
  availableCount: number
  latestUpdatedAt: string | null
}

export type AdminPagination = {
  page: number
  pageSize: number
  total: number
}

export type AdminOrderListResponse = {
  items: AdminOrderListItem[]
  pagination: AdminPagination
}

export type AdminTaskListResponse = {
  items: AdminTaskListItem[]
  pagination: AdminPagination
}

export type AdminInventoryListResponse = {
  items: AdminInventoryItemListItem[]
  pagination: AdminPagination
}

export type AdminWebhookEventListResponse = {
  items: AdminWebhookEventListItem[]
  pagination: AdminPagination
}

export type AdminInventorySkuSuggestionResponse = {
  items: AdminInventorySkuSuggestion[]
}
