terraform {
  required_providers {
    zitadel = {
      source  = "zitadel/zitadel"
      version = "2.0.2"
    }
  }
}

resource "zitadel_application_api" "default" {
  depends_on = [var.wait_on]

  org_id     = var.org_id
  project_id = var.project_id

  name             = var.name
  auth_method_type = "API_AUTH_METHOD_TYPE_BASIC"
  // TODO: Change this to private key jwt in the future
}

output "installed" {
  value = true
  depends_on = [zitadel_application_api.default]
}

output "application_id" {
  value = zitadel_application_api.default.id
}

output "client_id" {
  value     = zitadel_application_api.default.client_id
  sensitive = true
}

output "client_secret" {
  value     = zitadel_application_api.default.client_secret
  sensitive = true
}
