package mx.gob.slp.baseadminweb.configuration.security;

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

@ConfigurationProperties(prefix = "app.cognito")
public class CognitoProperties {

    private boolean enabled;
    private String region = "us-east-1";
    private String userPoolId = "us-east-1_BaseAdminWeb";
    private String issuerUri = "http://localhost:4566/us-east-1_BaseAdminWeb";
    private String jwkSetUri = "http://localhost:4566/us-east-1_BaseAdminWeb/.well-known/jwks.json";
    private String endpoint;
    private String scannerClientId;
    private String adminClientId;
    private String scannerGroup = "scanners";
    private String adminGroup = "admins";

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getUserPoolId() {
        return userPoolId;
    }

    public void setUserPoolId(String userPoolId) {
        this.userPoolId = userPoolId;
    }

    public String getIssuerUri() {
        return issuerUri;
    }

    public void setIssuerUri(String issuerUri) {
        this.issuerUri = issuerUri;
    }

    public String getJwkSetUri() {
        return jwkSetUri;
    }

    public void setJwkSetUri(String jwkSetUri) {
        this.jwkSetUri = jwkSetUri;
    }

    public String getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }

    public boolean usesLocalEndpoint() {
        return endpoint != null && !endpoint.isBlank();
    }

    public String getScannerClientId() {
        return scannerClientId;
    }

    public void setScannerClientId(String scannerClientId) {
        this.scannerClientId = scannerClientId;
    }

    public String getAdminClientId() {
        return adminClientId;
    }

    public void setAdminClientId(String adminClientId) {
        this.adminClientId = adminClientId;
    }

    public String getScannerGroup() {
        return scannerGroup;
    }

    public void setScannerGroup(String scannerGroup) {
        this.scannerGroup = scannerGroup;
    }

    public String getAdminGroup() {
        return adminGroup;
    }

    public void setAdminGroup(String adminGroup) {
        this.adminGroup = adminGroup;
    }
}