export interface AdminCloudtentaclesSourceItem {
  key: string
  label: string
  baseUrl: string
  username: string
  password: string
  phone: string
  deviceId: string
  deviceType: number
}

export interface AdminCloudtentaclesSourcesConfig {
  enabled: boolean
  sources: AdminCloudtentaclesSourceItem[]
}

export interface AdminCloudtentaclesPersistedSession {
  token: string
  tokenMasked: string
  baseUrl: string
  username: string
  phoneMasked: string
  loggedInAt: string
  deviceId: string
  deviceType: number
  hasToken: boolean
}

export type AdminCloudtentaclesSessionItem = AdminCloudtentaclesPersistedSession

export interface AdminCloudtentaclesSessionsMap {
  [sourceKey: string]: AdminCloudtentaclesPersistedSession
}

export interface AdminCloudtentaclesSourceConfigResponse {
  filePath: string
  sessionFilePath: string
  enabled: boolean
  sources: AdminCloudtentaclesSourceItem[]
  sessions: AdminCloudtentaclesSessionsMap
}

export interface AdminCloudtentaclesSendSmsResult {
  baseUrl: string
  username: string
  phone: string
  phoneMasked: string
  sentAt: string
  responseMessage: string
}

export interface AdminCloudtentaclesSessionSummary {
  tokenMasked: string
  permissionCount: number
  permissions: string[]
  persisted?: boolean
}

export interface AdminCloudtentaclesLoginTestResult {
  baseUrl: string
  username: string
  phoneMasked: string
  loggedInAt: string
  responseMessage: string
  token: string
  session: AdminCloudtentaclesSessionSummary
  userInfo: Record<string, unknown>
  asset: number
}

export interface AdminCloudtentaclesValidateSessionResult {
  baseUrl: string
  loggedInAt: string
  session: AdminCloudtentaclesSessionSummary
  userInfo: Record<string, unknown>
  asset: number
}

export interface AdminCloudtentaclesSkuItem {
  id: number
  categoriesId: number
  name: string
  description: string
  image: string
  inventory: number
  price: number
  listingTime: string
  delistingTime: string
  buyLimitMin: number
  buyLimitMax: number
  raw: Record<string, unknown>
}

export interface AdminCloudtentaclesSkuListResult {
  baseUrl: string
  itemCount: number
  items: AdminCloudtentaclesSkuItem[]
  rawItems: Record<string, unknown>[]
}

/** @deprecated Use AdminCloudtentaclesSourceItem + AdminCloudtentaclesSourcesConfig instead */
export interface AdminCloudtentaclesSourceConfig {
  enabled: boolean
  baseUrl: string
  username: string
  password: string
  phone: string
  deviceId: string
  deviceType: number
}
