package com.magistr.app.config.auth;

import jakarta.annotation.PostConstruct;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
import org.springframework.stereotype.Component;

@Component
public class JwtSecurityStartupValidator {

    private final JwtProperties properties;
    private final Environment environment;

    public JwtSecurityStartupValidator(JwtProperties properties, Environment environment) {
        this.properties = properties;
        this.environment = environment;
    }

    @PostConstruct
    void validate() {
        boolean production = environment.acceptsProfiles(Profiles.of("prod", "production"));
        properties.validateForEnvironment(production);
    }
}
