export type AdminDefaultUser = {
  username: string
  password: string
  role: string
  status?: string
}

export type AgisoMessagingShopConfig = {
  enabled?: boolean
  shopName?: string
  accessToken?: string
  messageTemplate?: string
  autoDeliveryMessageTemplate?: string
  appSecret?: string
  apiVersion?: string
  sendMessageEndpoint?: string
}

export type AgisoMessagingShopsConfig = Record<string, AgisoMessagingShopConfig>

export type RuntimeConfig = {
  server: {
    port: number
  }
  browser: {
    chromePath: string
    headless: boolean | null
    devtools: boolean | null
    keepAlive: boolean | null
    prewarm: boolean | null
    slowMoMs: number | null
    vncResolution: string
  }
  session: {
    debug: boolean
  }
  ocr: {
    baseUrl: string
  }
  data: {
    root: string
  }
  logging: {
    level: string
  }
  database: {
    url: string
    ssl: boolean
    maxConnections: number
  }
  orders: {
    claimBaseUrl: string
    tokenTtlHours: number
  }
  admin: {
    sessionSecret: string
    sessionTtlHours: number
    defaultUsers: AdminDefaultUser[]
  }
  platforms: {
    agiso: {
      appSecret: string
      tradeDetail: {
        endpoint: string
        apiVersion: string
        timeoutMs: number
      }
      autoDelivery: {
        enabled: boolean
        endpoint: string
        apiVersion: string
      }
      messaging: {
        enabled: boolean
        apiVersion: string
        sendMessageEndpoint: string
        messageTemplate: string
        autoDeliveryMessageTemplate: string
        shops: AgisoMessagingShopsConfig
      }
    }
    ninetyone: {
      userId: string
      secret: string
      version: string
      shopId: string
      shopName: string
      timestampToleranceSeconds: number
      cardsEncoding: string
    }
    cloudtentacles: {
      baseUrl: string
      timeoutMs: number
      sendSmsPath: string
      loginPath: string
      userInfoPath: string
      assetPath: string
      permissionPath: string
      categoriesPath: string
      skuListPath: string
      skuBuyPath: string
      skuUsePath: string
      knapsackPath: string
      vnListPath: string
      vnAppointPath: string
      vnGenerateLoginCodePath: string
      vnVerifCodePath: string
      vnVerifyLoginCodePath: string
      vnBindUrlPath: string
      vnBindInfoPath: string
      vnBackPath: string
      bindUrlTtlSeconds: number
      bindUrlProbeIntervalSeconds: number
      bindUrlProbeTimeoutMs: number
      bindUrlProbeUserAgent: string
      bindUrlProbeEndpoint: string
      bindUrlProbeChartId: string
      bindUrlProbeSubChartId: string
      bindUrlProbeIdeToken: string
      bindUrlProbeActivityUrl: string
      bindUrlProbeReferer: string
      bindUrlProbeExtraCookie: string
      publicKeyPem: string
      clientSource: string
      deviceId: string
      deviceType: number
    }
  }
  redeem: {
    proofMode: string
  }
}
