variable "org_id" {
  type        = string
  description = "Organization ID where the resources should be created"
}

variable "datasources" {
  description = "List of Grafana data sources"
  type = list(object({
    # Main parameters
    name        = string                 # Data source name (displayed in Grafana)
    uid         = string                 # Unique source identifier
    type        = string                 # Data source type (e.g., prometheus, mysql, clickhouse)
    url         = optional(string, null) # Connection URL (for most sources)
    username    = optional(string, null)
    access_mode = string # Access mode: proxy or direct
    is_default  = bool   # Set as default source

    # Authentication settings
    basic_auth          = optional(bool, false)  # Use basic authentication
    basic_auth_user     = optional(string, null) # Username for basic authentication
    basic_auth_password = optional(string, null) # Password for basic authentication

    # Additional parameters
    json_data        = optional(map(any), {})    # Additional parameters in JSON format
    secure_json_data = optional(map(string), {}) # Sensitive data in JSON format
    http_headers     = optional(map(string), {})

    # Terraform lifecycle management fields
    keep_manual_changes         = optional(bool, false) # Ignore manual changes in Grafana
    prevent_destroy_on_recreate = optional(bool, false) # Prevent resource deletion on update
  }))
}
