package com.sonymusic.dx.dxuiservice.properties;

import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.bind.ConstructorBinding;

@Getter
@ConfigurationProperties(prefix = "app")
public class ProtectedPathsProperties {

    /**
     * Protected paths.
     */
    private final List<@NotBlank String> protectedPaths;

    /**
     * Constructor.
     *
     * @param protectedPaths protected paths
     */
    @ConstructorBinding
    public ProtectedPathsProperties(final List<String> protectedPaths) {
        this.protectedPaths = List.copyOf(protectedPaths);
    }

    public List<String> getProtectedPaths() {
        return List.copyOf(protectedPaths);
    }

    public String[] getProtectedPathsArray() {
        return protectedPaths != null ? protectedPaths.toArray(new String[0]) : new String[0];
    }
}
