# questions
_metadata:
  module_name: task_dispatch_service
  version: 1.0.0
  destination_path: .

# questions
component_name:
  type: str
  help: What is the name of this component (snake_case)?
  default: task_dispatch_service
  validator: "{% if not component_name %}Required{% endif %}"

resource_name:
  type: str
  help: Resource name (lower case, alphanumeric characters, '-')?
  default: "{{ component_name | convert_resource_name }}"
  validator: "{% if not resource_name %}Required{% endif %}"

service_path:
  type: str
  help: "The relative path used in ingress as http://my-domain/[service_path]"
  default: "{{resource_name}}"

region:
  type: str
  help: Which Google Cloud region?
  default: us-central1
  validator: "{% if not region %}Required{% endif %}"

task_pubsub_topic:
  type: str
  help: Task pub/sub topic?
  default: task-topic

pubsub_message_retention_duration:
  type: str
  help: Pub/sub message retention duration?
  default: 86600s

deploy_method:
  type: str
  help: "Deploy method for {{component_name}}? (cloudrun or gke)"
  choices:
    Cloud Run: cloudrun
    GKE: gke
  default: cloudrun

depend_on_common:
  type: bool
  help: Does this component require the Common image?
  default: no

eventarc_trigger_name:
  type: str
  help: EventArc trigger name?
  default: trigger-task-pubsub

destination_cloudrun_service:
  type: str
  help: Destination Cloud Run service name?
  default: ""
  when: "{{default_deploy == 'cloudrun'}}"

eventarc_gke_cluster:
  type: str
  help: Destination GKE cluster name?
  default: "main-cluster"
  when: "{{default_deploy == 'gke'}}"

eventarc_gke_namespace:
  type: str
  help: Destination GKE namespace?
  default: "default"
  when: "{{default_deploy == 'gke'}}"

eventarc_gke_path:
  type: str
  help: Destination GKE service path?
  default: "/{{service_path}}/task/dispatch"
  when: "{{default_deploy == 'gke'}}"

eventarc_gke_service:
  type: str
  help: Destination GKE Run service name?
  default: "task-dispatch-service"
  when: "{{default_deploy == 'gke'}}"

terraform_stage:
  type: str
  help: Name of the terraform stage?
  default: "3-{{component_name | to_kebab}}"

_answers_file: ".sb/component_answers/{{component_name}}.yaml"

_templates_suffix: ""

_patch:
  - "skaffold.yaml"

_exclude:
  - "README.md"
  - "copier.yaml"
  - ".terraform*"
  - ".tmp"
  - ".venv"
  - ".pytest_cache"
  - "__pycache__"
  - "*-debug.log"

_jinja_extensions:
  - jinja2_time.TimeExtension
  - jinja2_strcase.StrcaseExtension
  - copier_templates_extensions.TemplateExtensionLoader
  - ../../copier_extensions/sb_helpers.py:SolutionsTemplateHelpersExtension
