{{- if and .Values.externalSecrets.enabled .Values.externalSecrets.manageEDPInstallSecrets .Values.externalSecrets.manageCodemieSecretsName -}}
{{- $secretStore := include "edp-install.secretStoreName" . }}
{{- $awsSecretName := .Values.externalSecrets.manageCodemieSecretsName }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: ci-codemie
spec:
  target:
    template:
      metadata:
        labels:
          app.edp.epam.com/secret-type: chat-assistant
          app.edp.epam.com/integration-secret: "true"
  refreshInterval: 1h
  secretStoreRef:
    kind: SecretStore
    name: {{ $secretStore }}
  data:
  - secretKey: apiUrl
    remoteRef:
      key: {{ $awsSecretName }}
      property: ci-codemie.apiUrl
  - secretKey: assistantId
    remoteRef:
      key: {{ $awsSecretName }}
      property: ci-codemie.assistantId
  - secretKey: token
    remoteRef:
      key: {{ $awsSecretName }}
      property: ci-codemie.token
{{- end }}
