spring:
  application:
    name: saas-multitenant-api
  
  main:
    allow-bean-definition-overriding: true
  
  datasource:
    url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:saas_db}?createDatabaseIfNotExist=true&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
    username: ${MYSQL_USER:root}
    password: ${MYSQL_PASSWORD:password}
    driver-class-name: com.mysql.cj.jdbc.Driver
    hikari:
      maximum-pool-size: 10
      connection-timeout: 30000
  
  data:
    redis:
      host: ${REDIS_HOST:localhost}
      port: ${REDIS_PORT:6379}
      password: ${REDIS_PASSWORD:}
      timeout: 2000ms
  
  jpa:
    database-platform: org.hibernate.dialect.MariaDBDialect
    hibernate:
      ddl-auto: update
      naming:
        physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
    show-sql: true
    properties:
      hibernate:
        dialect: org.hibernate.dialect.MariaDBDialect
        format_sql: true
  
  flyway:
    enabled: false

server:
  port: ${SERVER_PORT:8000}
  base-url: ${SERVER_BASE_URL:http://localhost:8000}
  fallback-url: ${SERVER_FALLBACK_URL:https://your-domain.com}
  error:
    include-message: always
    include-binding-errors: always

jwt:
  secret: ${SESSION_SECRET}
  expiration: 86400000

multitenancy:
  admin-schema: saas_db
  tenant-schema-prefix: tenant_
  datasource:
    max-active-pools: 100
    pool-size: 5
    eviction-timeout-minutes: 30

# VoIP Configuration
openai:
  api:
    key: ${OPENAI_API_KEY:your-openai-api-key-here}
  realtime:
    ws-url: wss://api.openai.com/v1/realtime?model=gpt-4o-realtime-preview-2024-10-01
    voice: alloy

gemini:
  api:
    key: ${GEMINI_API_KEY:your-gemini-api-key-here}
  realtime:
    model: gemini-2.0-flash-exp
    ws-url: wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContent

twilio:
  account:
    sid: ${TWILIO_ACCOUNT_SID:your-account-sid}
  auth:
    token: ${TWILIO_AUTH_TOKEN:your-auth-token}
  phone:
    number: ${TWILIO_PHONE_NUMBER:+1234567890}
  ai:
    provider: ${TWILIO_AI_PROVIDER:OPENAI}
    openai:
      api-key: ${OPENAI_API_KEY:your-openai-api-key-here}
      model: gpt-4o-realtime-preview-2024-10-01
      ws-url: wss://api.openai.com/v1/realtime
    elevenlabs:
      api-key: ${ELEVENLABS_API_KEY:your-elevenlabs-api-key}
      agent-id: ${ELEVENLABS_AGENT_ID:your-elevenlabs-agent-id}
      ws-url: wss://api.elevenlabs.io/v1/convai/conversation

telnyx:
  api:
    key: ${TELNYX_API_KEY:your-telnyx-api-key}
    base-url: https://api.telnyx.com/v2
  sms:
    api-url: https://api.telnyx.com/v2/messages

vapi:
  api:
    token: ${VAPI_PRIVATE_TOKEN:1d0d756b-7c09-4af7-b5f4-c3213d328145}
    base-url: https://api.vapi.ai
  webhook:
    secret: ${VAPI_WEBHOOK_SECRET:687a56a5-c749-4cd0-b83c-1f2f19490d84}
  cost:
    per-minute-min: 0.13
    per-minute-max: 0.31

retell:
  api:
    key: ${RETELL_API_KEY:key_e55787fb3a1d6dceff0f41b3d24f}
    base-url: https://api.retellai.com
  webhook:
    secret: ${RETELL_WEBHOOK_SECRET:key_e55787fb3a1d6dceff0f41b3d24f}
  cost:
    per-minute: 0.20

stripe:
  api:
    key: ${STRIPE_API_KEY:sk_test_placeholder}
  webhook:
    secret: ${STRIPE_WEBHOOK_KEY:sk_test_placeholder}
# Kafka Configuration for Event-Driven Architecture
spring.kafka:
  bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS:localhost:9092}
  consumer:
    group-id: saas-voip-group
    auto-offset-reset: earliest
    enable-auto-commit: false
  producer:
    acks: all
    retries: 3

logging:
  level:
    com.saas: INFO
    org.springframework.security: INFO
    org.springframework.security.web.FilterChainProxy: WARN
    org.springframework.kafka: INFO

management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics
  endpoint:
    health:
      show-details: always
  info:
    env:
      enabled: true

springdoc:
  api-docs:
    path: /api-docs
  swagger-ui:
    path: /swagger-ui.html
    tags-sorter: alpha
    operations-sorter: alpha

# Emma AI Assistant Configuration
emma:
  prompts:
    fallback: |
      Vous êtes Emma, un assistant médical professionnel et bienveillant de l'Hôpital La Rive Bleue.
      
      Votre rôle:
      - Prendre des rendez-vous médicaux
      - Collecter les informations patient: nom complet, numéro de téléphone, médecin souhaité, date et heure souhaitées
      - Répondre UNIQUEMENT en français
      - Être concis et clair (c'est un appel téléphonique)
      - Épeler les chiffres et dates clairement
      - Ne jamais utiliser d'emojis, astérisques ou caractères spéciaux
      
      REMARQUE IMPORTANTE: Vous devez TOUJOURS répondre en français, peu importe la langue utilisée par l'utilisateur.
