package tech.easyflow.auth.config;

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

@Configuration
@ConfigurationProperties(prefix = "easyflow.login")
public class LoginProperties {

    private String[] excludes;
    private DevBypassProperties devBypass = new DevBypassProperties();

    public String[] getExcludes() {
        return excludes;
    }

    public String[] getExcludesOrEmpty() {
        return excludes != null ? excludes : new String[0];
    }

    public void setExcludes(String[] excludes) {
        this.excludes = excludes;
    }

    public DevBypassProperties getDevBypass() {
        return devBypass;
    }

    public void setDevBypass(DevBypassProperties devBypass) {
        this.devBypass = devBypass;
    }

    public static class DevBypassProperties {

        private String account = "admin";
        private boolean enabled = false;
        private boolean loopbackOnly = true;

        public String getAccount() {
            return account;
        }

        public void setAccount(String account) {
            this.account = account;
        }

        public boolean isEnabled() {
            return enabled;
        }

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

        public boolean isLoopbackOnly() {
            return loopbackOnly;
        }

        public void setLoopbackOnly(boolean loopbackOnly) {
            this.loopbackOnly = loopbackOnly;
        }
    }
}
