package com.css.simulation.resource.scene.common.minio;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@ConfigurationProperties(prefix = "minio")
public class MinioConfiguration {

    private String endpointPrivate;
    private String endpointPublic;
    private String accessKey;
    private String secretKey;

    @Bean
    public MinioClient minioClientPrivate() {
        MinioClient minioClient = MinioClient.builder()
                .endpoint(endpointPrivate)
                .credentials(accessKey, secretKey)
                .build();
        return minioClient;
    }

    @Bean
    public MinioClient minioClientPublic() {
        MinioClient minioClient = MinioClient.builder()
                .endpoint(endpointPublic)
                .credentials(accessKey, secretKey)
                .build();
        return minioClient;
    }

}