---

layout:
  application:
    # built-in templates
    - name: configure
      source: asset:serverConfigureapi
      target: "{{ joinFilePath .Target .ServerPackage }}"
      file_name: "configure_{{ .Name }}.go"
      skip_exists: true
    - name: embedded_spec
      source: asset:swaggerJsonEmbed
      target: "{{ joinFilePath .Target .ServerPackage }}"
      file_name: "embedded_spec.go"
    - name: builder
      source: asset:serverBuilder
      target: "{{ joinFilePath .Target .ServerPackage .Package }}"
      file_name: "{{ snakize (pascalize .Name) }}_api.go"
    - name: doc
      source: asset:serverDoc
      target: "{{ joinFilePath .Target .ServerPackage }}"
      file_name: "doc.go"

    # custom templates
    - name: logging
      source: server/logging.gotmpl
      target: "{{ if gt (len .Tags) 0 }}{{ joinFilePath .Target .ServerPackage .APIPackage .Package  }}{{ else }}{{ joinFilePath .Target .ServerPackage .Package  }}{{ end }}"
      file_name: "logging.go"
    - name: init_prometheus
      source: server/initPrometheus.gotmpl
      target: "{{ joinFilePath .Target .ServerPackage .Package }}"
      file_name: "prometheus.go"

    - name: main
      source: server/main.gotmpl
      target: "{{ joinFilePath .Target \"cmd\" (dasherize (pascalize .Name)) }}"
      file_name: main.go
    - name: migration
      source: server/migration.gotmpl
      target: "{{ joinFilePath .Target \"migration\" }}"
      file_name: migration.go
    - name: cmd
      source: server/cmd.gotmpl
      target: "{{ joinFilePath .Target \"cmd\" (dasherize (pascalize .Name)) }}/cmd"
      file_name: cmd.go
    - name: cmdMigrate
      source: server/cmdMigrate.gotmpl
      target: "{{ joinFilePath .Target \"cmd\" (dasherize (pascalize .Name)) }}/cmd"
      file_name: migrate.go
    - name: cmdServe
      source: server/cmdServe.gotmpl
      target: "{{ joinFilePath .Target \"cmd\" (dasherize (pascalize .Name)) }}/cmd"
      file_name: serve.go
    - name: cmdServeConfig
      source: server/cmdServeConfig.gotmpl
      target: "{{ joinFilePath .Target \"cmd\" (dasherize (pascalize .Name)) }}/cmd"
      file_name: serve_config.go
      skip_exists: true
    - name: cmdCustomInfo
      source: server/cmdCustomInfo.gotmpl
      target: "{{ joinFilePath .Target \"cmd\" (dasherize (pascalize .Name)) }}/cmd"
      file_name: custom_info.go
      skip_exists: true
    - name: cmdVersion
      source: server/cmdVersion.gotmpl
      target: "{{ joinFilePath .Target \"cmd\" (dasherize (pascalize .Name)) }}/cmd"
      file_name: version.go
    - name: configure
      source: server/configureapi.gotmpl
      target: "{{ joinFilePath .Target .ServerPackage }}"
      file_name: "configure_{{ .Name }}.go"
      skip_exists: true
    - name: version
      source: server/versionapi.gotmpl
      target: "{{ joinFilePath .Target .ServerPackage }}"
      file_name: version.go

  models:
    # built-in templates
    - name: definition
      source: asset:model
      target: "{{ joinFilePath .Target .ModelPackage }}"
      file_name: "{{ (snakize (pascalize .Name)) }}.go"
  operations:
    # built-in templates
    - name: parameters
      source: asset:serverParameter
      target: "{{ if gt (len .Tags) 0 }}{{ joinFilePath .Target .ServerPackage .APIPackage .Package  }}{{ else }}{{ joinFilePath .Target .ServerPackage .Package  }}{{ end }}"
      file_name: "{{ (snakize (pascalize .Name)) }}_parameters.go"
    - name: responses
      source: asset:serverResponses
      target: "{{ if gt (len .Tags) 0 }}{{ joinFilePath .Target .ServerPackage .APIPackage .Package  }}{{ else }}{{ joinFilePath .Target .ServerPackage .Package  }}{{ end }}"
      file_name: "{{ (snakize (pascalize .Name)) }}_responses.go"
    - name: handler
      source: asset:serverOperation
      target: "{{ if gt (len .Tags) 0 }}{{ joinFilePath .Target .ServerPackage .APIPackage .Package  }}{{ else }}{{ joinFilePath .Target .ServerPackage .Package  }}{{ end }}"
      file_name: "{{ (snakize (pascalize .Name)) }}.go"

    # custom templates
    - name: prometheus
      source: server/prometheus.gotmpl
      target: "{{ if gt (len .Tags) 0 }}{{ joinFilePath .Target .ServerPackage .APIPackage .Package  }}{{ else }}{{ joinFilePath .Target .ServerPackage .Package  }}{{ end }}"
      file_name: "{{ (snakize (pascalize .Name)) }}_prometheus.go"

  operation_groups:
    - name: operation_init_prometheus
      source: server/operationInitPrometheus.gotmpl
      target: "{{ joinFilePath .Target .ServerPackage .APIPackage (snakize (pascalize .Name)) }}"
      file_name: "prometheus.go"
