package ru.soune.nocopy.configuration;

import com.vrt.AudioFilePathProvider;
import com.vrt.fileprotection.FileProtector;
import com.vrt.fileprotection.audio.AudioLocalSearch;
import com.vrt.fileprotection.documents.DocumentLocalSearch;
import com.vrt.fileprotection.image.ImageLocalSearch;
import com.vrt.fileprotection.image.ImageUniqueCheck;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

import java.util.Collections;

@Configuration
@EnableAutoConfiguration
@AllArgsConstructor
public class ApplicationConfig {

    @Bean
    PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }

    @Bean
    public com.vrt.
            NoCopyFileService noCopyFileService(
            FileProtector.FileProvider fileProvider,
            FileProtector.ProcessingListener processingListener,
            ImageUniqueCheck imageUniqueCheck,
            ImageLocalSearch imageLocalSearch,
            AudioLocalSearch audioLocalSearch,
            AudioFilePathProvider audioFilePathProvider,
            DocumentLocalSearch documentLocalSearch) {

        return new com.vrt.NoCopyFileService(
                Collections.emptyList(),
                fileProvider,
                processingListener,
                imageUniqueCheck,
                imageLocalSearch,
                audioLocalSearch,
                audioFilePathProvider,
                documentLocalSearch
        );
    }
}

