package go.kr.project.api.internal.config;

import go.kr.project.api.config.properties.VmisProperties;
import go.kr.project.api.internal.gpki.GpkiService;
import go.kr.project.api.internal.gpki.NoopGpkiService;
import go.kr.project.api.internal.gpki.RealGpkiService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class GpkiConfig {

    @Bean
    public GpkiService gpkiService(VmisProperties properties) {
        if (properties.getGpki().isEnabledFlag()) {
            return new RealGpkiService(properties);
        }
        return new NoopGpkiService();
    }
}
