import os
from typing import TYPE_CHECKING

import boto3

if TYPE_CHECKING:
    from mypy_boto3_dynamodb.client import DynamoDBClient
    from mypy_boto3_s3 import S3Client
    from mypy_boto3_sesv2 import SESV2Client
else:
    DynamoDBClient = object
    SESV2Client = object
    S3Client = object


def get_dynamodb_client() -> DynamoDBClient:
    if os.getenv('AWS_LAMBDA_FUNCTION_NAME'):
        return boto3.client('dynamodb')

    return boto3.client('dynamodb', endpoint_url='http://127.0.0.1:8000')


s3_client: S3Client = boto3.client('s3')
dynamodb_client: DynamoDBClient = get_dynamodb_client()
sesv2_client: SESV2Client = boto3.client('sesv2')
