import boto3
from mypy_boto3_translate import TranslateClient

from src.translation.providers.abstract import AbstractTranslationProvider
from src.models.texts.languages import Language

client: TranslateClient = boto3.client('translate')


class AWSTranslationProvider(AbstractTranslationProvider):
    def translate(self, txt: str, source: Language, target: Language):
        return client.translate_text(
            Text=txt,
            SourceLanguageCode=source.name,
            TargetLanguageCode=target.name
        )
