package egovframework.configProperties;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * RestTemplate 관련 설정 속성
 * application.yml의 rest-template 설정값을 읽어옴
 */
@Setter
@Getter
@Configuration
@ConfigurationProperties(prefix = "rest-template")
public class RestTemplateProperties {

    private Timeout timeout = new Timeout();
    private ConnectionPool connectionPool = new ConnectionPool();
    private RateLimit rateLimit = new RateLimit();

    @Setter
    @Getter
    public static class Timeout {
        private int connectTimeoutMillis = 10000;  // 기본값: 10초
        private int readTimeoutMillis = 10000;     // 기본값: 10초
    }

    @Setter
    @Getter
    public static class ConnectionPool {
        private int maxTotal = 100;           // 기본값: 최대 100 연결
        private int maxPerRoute = 20;         // 기본값: 경로당 20 연결
    }

    @Setter
    @Getter
    public static class RateLimit {
        private double permitsPerSecond = 5.0;  // 기본값: 초당 5건
    }
}
