spring.application.name=parser
java.awt.headless=true

# =============================================================================
# SECRETS
# -----------------------------------------------------------------------------
# Every credential below is resolved from an environment variable with NO
# default, so the application fails fast at startup if one is missing instead
# of silently authenticating as nobody. See .env.example for the full list and
# docs/configuration.md for how they are supplied per environment.
# =============================================================================

# --- MongoDB ---
spring.data.mongodb.host=${MONGODB_HOST:localhost}
spring.data.mongodb.port=${MONGODB_PORT:27017}
spring.data.mongodb.database=${MONGODB_DATABASE:parser_db}
spring.data.mongodb.username=${MONGODB_USERNAME}
spring.data.mongodb.password=${MONGODB_PASSWORD}
spring.data.mongodb.authentication-database=${MONGODB_AUTH_DATABASE:admin}
spring.data.mongodb.connection-timeout=30000
spring.data.mongodb.socket-timeout=30000
spring.data.mongodb.server-selection-timeout=30000

# --- MinIO object storage ---
minio.endpoint=${MINIO_ENDPOINT}
minio.access-key=${MINIO_ACCESS_KEY}
minio.secret-key=${MINIO_SECRET_KEY}
minio.bucket-name=${MINIO_BUCKET_NAME:konturai}

# --- Application security ---
security.jwt.secret-base64=${JWT_SECRET_BASE64}
encryption.secret-key=${ENCRYPTION_SECRET_KEY}

# =============================================================================
# AI PROVIDERS
# =============================================================================

# --- Ollama (self-hosted text model) ---
ollama.host=${OLLAMA_HOST:http://localhost:11434}
ollama.model=${OLLAMA_MODEL:gemma3:1b}
ollama.timeoutMs=18000000
ollama.connectTimeoutMs=10000000
ollama.responseTimeoutMs=18000000

# --- OpenAI ---
openai.api.key=${OPENAI_API_KEY}
openai.api.url=https://api.openai.com/v1/chat/completions
openai.model.name=gpt-5-nano
openai.model.name.text=gpt-5-mini
openai.timeoutMs=90000
openai.timeoutMs.instruction=180000
openai.retry.maxAttempts=3
openai.retry.initialDelayMs=2000
openai.retry.maxDelayMs=60000
openai.retry.multiplier=2.0
openai.retry.rateLimitMaxAttempts=10
openai.retry.rateLimitInitialDelayMs=5000
openai.retry.rateLimitMaxDelayMs=300000
openai.rateLimit.maxConcurrentRequests=3

# --- Image generation ---
image.generation.provider=${IMAGE_GENERATION_PROVIDER:nano-banana}
image.generation.delayBetweenRequestsMs=3000
openai.image.model=dall-e-3
openai.image.size=1024x1024
openai.image.quality=hd
openai.image.style=natural

# --- Google Vertex AI (Imagen / Veo) ---
# Authenticates with the service-account JSON on the classpath at
# keys/google-key.json. That file is NOT in version control - see
# docs/configuration.md.
google.cloud.project-id=${GOOGLE_CLOUD_PROJECT_ID}
google.cloud.location=${GOOGLE_CLOUD_LOCATION:us-central1}
google.gemini.image.model=imagen-3.0-generate-001
google.gemini.video.model=veo-3.0-generate-001
google.gemini.timeoutMs=120000
google.gemini.retry.maxAttempts=5
google.gemini.retry.initialDelayMs=10000
google.gemini.retry.maxDelayMs=120000
google.gemini.retry.multiplier=2.0
google.gemini.rateLimit.delayMs=20000

# --- Serper (Google search API) ---
serper.api.key=${SERPER_API_KEY}
serper.api.url=https://google.serper.dev
serper.timeoutMs=30000
serper.retry.maxAttempts=3
serper.retry.initialDelayMs=1000
serper.retry.maxDelayMs=10000
serper.retry.multiplier=2.0

# --- Deep research service ---
deep-research.api.url=${DEEP_RESEARCH_API_URL}
deep-research.api.timeout=1800000

# --- Targeting AI models ---
targeting.ai.audience-model=gpt-5-mini
targeting.ai.max-audience-tokens=2500
targeting.ai.budget-model=gpt-5-nano
targeting.ai.max-budget-tokens=1000
targeting.ai.creatives-model=gpt-5-mini
targeting.ai.max-creatives-tokens=2000

# =============================================================================
# SOCIAL NETWORKS
# =============================================================================

# --- Facebook posting ---
facebook.app.id=${FACEBOOK_APP_ID}
facebook.app.secret=${FACEBOOK_APP_SECRET}
facebook.page.id=${FACEBOOK_PAGE_ID}
facebook.page.token=${FACEBOOK_PAGE_TOKEN}

# --- Facebook hot leads collector ---
facebook.leads.page-id=${FACEBOOK_LEADS_PAGE_ID}
facebook.leads.access-token=${FACEBOOK_LEADS_ACCESS_TOKEN}
facebook.leads.cron=${FACEBOOK_LEADS_CRON:0 */15 * * * *}
facebook.leads.graph-api-version=${FACEBOOK_LEADS_GRAPH_API_VERSION:v19.0}
facebook.leads.timeout-ms=${FACEBOOK_LEADS_TIMEOUT_MS:30000}
facebook.leads.posts-page-size=${FACEBOOK_LEADS_POSTS_PAGE_SIZE:25}
facebook.leads.comments-page-size=${FACEBOOK_LEADS_COMMENTS_PAGE_SIZE:100}

# --- Facebook leads -> call centre sync ---
facebook.leads.call-center.enabled=${FACEBOOK_LEADS_CALL_CENTER_ENABLED:true}
facebook.leads.call-center.base-url=${FACEBOOK_LEADS_CALL_CENTER_BASE_URL:http://localhost:8080}
facebook.leads.call-center.customer-path=${FACEBOOK_LEADS_CALL_CENTER_CUSTOMER_PATH:/proxy/customer/customers}
facebook.leads.call-center.interaction-path=${FACEBOOK_LEADS_CALL_CENTER_INTERACTION_PATH:/proxy/interaction/interactions}
facebook.leads.call-center.auth-login-path=${FACEBOOK_LEADS_CALL_CENTER_AUTH_LOGIN_PATH:/proxy/auth/auth/login}
facebook.leads.call-center.auth-username=${FACEBOOK_LEADS_CALL_CENTER_AUTH_USERNAME}
facebook.leads.call-center.auth-password=${FACEBOOK_LEADS_CALL_CENTER_AUTH_PASSWORD}
facebook.leads.call-center.actor-user=${FACEBOOK_LEADS_CALL_CENTER_ACTOR_USER:facebook-lead-bot}
facebook.leads.call-center.actor-role=${FACEBOOK_LEADS_CALL_CENTER_ACTOR_ROLE:admin}
facebook.leads.call-center.interaction-channel=${FACEBOOK_LEADS_CALL_CENTER_INTERACTION_CHANNEL:webchat}
facebook.leads.call-center.interaction-queue-id=${FACEBOOK_LEADS_CALL_CENTER_INTERACTION_QUEUE_ID:q_main}
facebook.leads.call-center.timeout-ms=${FACEBOOK_LEADS_CALL_CENTER_TIMEOUT_MS:30000}
facebook.leads.call-center.subject-prefix=${FACEBOOK_LEADS_CALL_CENTER_SUBJECT_PREFIX:[Facebook]}

# --- Telegram ---
telegram.api.timeout=30000

# =============================================================================
# RSS SOURCES
# =============================================================================
rss.feed.url=https://kursiv.media/feed/
rss.kapital.url=https://kapital.kz/rss/
rss.lsm.url=https://lsm.kz/rss
rss.rbc.url=https://static.feed.rbc.ru/rbc/logical/footer/news.rss
rss.vedomosti.url=https://www.vedomosti.ru/rss/rubric/technology/internet

# =============================================================================
# SCHEDULING
# =============================================================================
parser.scheduler.enabled=${PARSER_SCHEDULER_ENABLED:false}
posting.scheduler.enabled=${POSTING_SCHEDULER_ENABLED:true}
spring.task.scheduling.pool.size=5
spring.task.scheduling.thread-name-prefix=scheduled-task-

# =============================================================================
# MAIL
# =============================================================================
spring.mail.host=${MAIL_HOST:smtp.gmail.com}
spring.mail.port=${MAIL_PORT:587}
spring.mail.username=${MAIL_USERNAME}
spring.mail.password=${MAIL_PASSWORD}
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
management.health.mail.enabled=false

# =============================================================================
# CORS
# =============================================================================
cors.allowed-origins=${CORS_ALLOWED_ORIGINS:${CORS_ALLOWED_ORIGIN:https://konturai.kz,https://www.konturai.kz}}
cors.allowed-methods=${CORS_ALLOWED_METHODS:GET,POST,PUT,PATCH,DELETE,OPTIONS}
cors.allowed-headers=${CORS_ALLOWED_HEADERS:*}
cors.exposed-headers=${CORS_EXPOSED_HEADERS:Location,Content-Disposition}
cors.allow-credentials=${CORS_ALLOW_CREDENTIALS:true}
cors.max-age-seconds=${CORS_MAX_AGE_SECONDS:3600}

# =============================================================================
# LOGGING
# =============================================================================
logging.level.kz.konturai.parser.service.KursivParserService=INFO
logging.level.kz.konturai.parser.service.KapitalParserService=INFO
logging.level.kz.konturai.parser.service.LsmParserService=INFO
logging.level.kz.konturai.parser.service.RbcParserService=INFO
logging.level.kz.konturai.parser.service.VedomostiParserService=INFO
logging.level.kz.konturai.parser.service.OllamaAnalyticsService=INFO
logging.level.kz.konturai.parser.service.GeminiVideoGenerationService=INFO
logging.level.kz.konturai.parser.service.NanoBananaImageGenerationService=INFO
logging.level.kz.konturai.parser.service.FacebookLeadCollectorService=INFO
logging.level.kz.konturai.parser.service.FacebookLeadGraphApiClient=INFO
logging.level.kz.konturai.parser.service.FacebookLeadCallCenterSyncService=INFO
logging.level.kz.konturai.parser.controller.MarketingController=DEBUG
logging.level.kz.konturai.parser.service.MarketingAnalysisService=DEBUG
logging.level.kz.konturai.parser.config.MongoConfig=WARN
logging.level.org.springframework.scheduling=DEBUG
logging.level.org.springframework.data.mongodb=INFO
logging.level.org.springframework.data.mongodb.core.convert=WARN
logging.level.com.mongodb=WARN
