{{- if and (eq .Values.auth.mode "oauth") .Values.auth.oauth.persistence.enabled (not .Values.auth.oauth.persistence.existingClaim) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ include "nextcloud-mcp-server.fullname" . }}-oauth-storage
  labels:
    {{- include "nextcloud-mcp-server.labels" . | nindent 4 }}
spec:
  accessModes:
    - {{ .Values.auth.oauth.persistence.accessMode }}
  {{- if .Values.auth.oauth.persistence.storageClass }}
  storageClassName: {{ .Values.auth.oauth.persistence.storageClass }}
  {{- end }}
  resources:
    requests:
      storage: {{ .Values.auth.oauth.persistence.size }}
{{- end }}
---
{{- if and (eq .Values.qdrant.mode "persistent") .Values.qdrant.localPersistence.enabled (not .Values.qdrant.localPersistence.existingClaim) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ include "nextcloud-mcp-server.fullname" . }}-qdrant-data
  labels:
    {{- include "nextcloud-mcp-server.labels" . | nindent 4 }}
spec:
  accessModes:
    - {{ .Values.qdrant.localPersistence.accessMode }}
  {{- if .Values.qdrant.localPersistence.storageClass }}
  storageClassName: {{ .Values.qdrant.localPersistence.storageClass }}
  {{- end }}
  resources:
    requests:
      storage: {{ .Values.qdrant.localPersistence.size }}
{{- end }}
