package com.prudas.app.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;

/**
 * Strongly-typed binding of the "app.*" configuration tree in application.yml.
 * Centralising this avoids @Value string-literal sprawl and makes every
 * externalised setting (especially secrets) discoverable in one place.
 */
@ConfigurationProperties(prefix = "app")
public record AppProperties(
        Cors cors,
        Jwt jwt,
        Security security,
        RateLimit rateLimit,
        Recaptcha recaptcha,
        Mail mail
) {
    public record Cors(List<String> allowedOrigins) {
    }

    public record Jwt(String secret, int accessTokenTtlMinutes, int refreshTokenTtlDays, String issuer) {
    }

    public record Security(int maxLoginAttempts, int lockoutDurationMinutes) {
    }

    public record RateLimit(int contactFormPerHour, int newsletterPerHour, int loginPer15Min) {
    }

    public record Recaptcha(boolean enabled, String secretKey, double minScore) {
    }

    public record Mail(boolean notificationsEnabled, String fromAddress, String contactNotifyAddress) {
    }
}
