from dishka import BaseScope, Provider, Scope, provide

from template_project.adapters.s3_storage import AioBoto3ClientLike, S3FileStorage
from template_project.application.common.file_storage import FileStorage
from template_project.web_api.configuration import S3Config


class StorageProvider(Provider):
    scope: BaseScope | None = Scope.APP

    @provide
    def s3_file_storage(
        self,
        client: AioBoto3ClientLike,
        s3_config: S3Config,
    ) -> FileStorage:
        return S3FileStorage(
            client=client,
            bucket_name=s3_config.bucket_name,
        )
