variable "aws_region" {
  default     = "us-east-1"
  description = "AWS region"
}

variable "environment" {
  description = "Available values:  qa, prod."
  default     = "qa"
}

variable "service_name" {
  default = "ows-resonance-engine"
}

variable "application_family" {
  default = "fansifter"
}

variable "secrets_manager_secret_names" {
  description = "List of secrets manager secrets to create."
  type        = list(string)
  default = [
    "ENCRYPTION_KEYS",
    "AUTH0_CLIENT_SECRET",
  ]
}

variable "auth0_domain" {
  description = "Auth0 tenant domain."
  default     = "qa-orchard.auth0.com"
}

variable "auth0_client_id" {
  description = "Auth0 application client ID."
  default     = "ZuHbHuQi7TFDw2X8qzu2TGGkZdN1mtCw"
}

variable "auth0_audience" {
  description = "Auth0 API audience identifier."
  default     = ""
}

variable "auth0_callback_url" {
  description = "OAuth2 callback URL."
  default     = "https://qa-ows-resonance-engine.theorchard.io/oauth2/callback"
}

variable "auth0_logout_redirect" {
  description = "Where Auth0 returns the user after logout."
  default     = "https://qa-ows-resonance-engine.theorchard.io/dashboard/login"
}

variable "dsp_secret_names" {
  description = "DSP integration client secret names (created alongside var.secrets_manager_secret_names; covered by a single IAM read policy). Extend when adding new DSPs."
  type        = list(string)
  default = [
    "SPOTIFY_SONGWHIP_CLIENT_SECRET",
    "SPOTIFY_SMF_SME_CLIENT_SECRET",
    "SPOTIFY_SMF_ORCH_CLIENT_SECRET",
    "AMAZON_SONGWHIP_CLIENT_SECRET",
    "APPLE_SONGWHIP_PRIVATE_KEY",
  ]
}

variable "msk_cluster_name" {
  description = "MSK Cluster name, without environment prefix"
  default     = "managed-kafka-fansifter"
}

variable "spotify_songwhip_client_id" {
  description = "Spotify OAuth client ID for the Songwhip integration."
  default     = "5ba39d4de28f418ab77932d80aab3171"
}

variable "spotify_smf_sme_client_id" {
  description = "Spotify OAuth client ID for the SMF - SME integration."
  default     = "193204e1f39c4134852b6c27cb87c3ed"
}

variable "spotify_smf_orch_client_id" {
  description = "Spotify OAuth client ID for the SMF - The Orchard integration."
  default     = "5dd4818b2e5b482584e2fa7dc2ef0db5"
}

variable "amazon_songwhip_client_id" {
  description = "Amazon Music OAuth client ID for the Songwhip integration."
  default     = "amzn1.application-oa2-client.59f09b3a8f2748b9bec958f7b621603e"
}

variable "amazon_songwhip_profile_id" {
  description = "Amazon Music LWA security profile ID for the Songwhip integration."
  default     = "amzn1.application.c2c64a6729894b42a0a536042d300331"
}

variable "apple_songwhip_team_id" {
  description = "Apple developer team ID for the Songwhip integration."
  default     = "4T2W2RCFT2"
}

variable "apple_songwhip_key_id" {
  description = "Apple MusicKit key ID for the Songwhip integration."
  default     = "U3KY7PPMM6"
}

variable "fan_fanout_window_s" {
  description = <<-EOT
    Fanout window in seconds. Single source of truth for the fan-fanout cron
    cadence (rate(this / 60 minutes)) and the FAN_FANOUT_WINDOW_S env var the
    planner sizes each run against. Keep a whole number of minutes.
  EOT
  type        = number
  default     = 300
}

variable "fan_collect_worker_timeout_s" {
  description = <<-EOT
    Fan-collect worker timeout in seconds. Single source of truth for the
    fan-collect Lambda timeout, the fan-collect SQS visibility_timeout
    (= this + 60 s margin), and the FAN_COLLECT_WORKER_TIMEOUT_S env var on
    every service that calls compute_infra_config.
  EOT
  type        = number
  default     = 300
}

locals {
  encryption_keys_secret_name         = "${var.environment}/${var.service_name}/ENCRYPTION_KEYS"
  spotify_songwhip_client_secret_name = "${var.environment}/${var.service_name}/SPOTIFY_SONGWHIP_CLIENT_SECRET"
  spotify_smf_sme_client_secret_name  = "${var.environment}/${var.service_name}/SPOTIFY_SMF_SME_CLIENT_SECRET"
  spotify_smf_orch_client_secret_name = "${var.environment}/${var.service_name}/SPOTIFY_SMF_ORCH_CLIENT_SECRET"
  amazon_songwhip_client_secret_name  = "${var.environment}/${var.service_name}/AMAZON_SONGWHIP_CLIENT_SECRET"
  apple_songwhip_private_key_name     = "${var.environment}/${var.service_name}/APPLE_SONGWHIP_PRIVATE_KEY"
  auth0_client_secret_name            = "${var.environment}/${var.service_name}/AUTH0_CLIENT_SECRET"
}
