from typing import Optional, Any
from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict


class WorkerConfig(BaseSettings):
    video_downloader_concurrency: int = Field(default=10, description="处理缓存任务的并行数")
    ffmpeg_worker_concurrency: int = Field(default=20, description="处理视频任务的并行数")
    ffmpeg_slice_worker_concurrency: int = Field(default=200, description="处理视频切割任务的并行数")
    local_output_mount: str = Field(default="/mnt/outputs", description="本地结果挂载路径前缀")

    S3_region: str = Field(default='ap-northeast-2', description="S3挂载桶的地域")
    S3_bucket_name: str = Field(default='modal-media-cache', description="集群挂载的S3存储桶")
    S3_mount_dir: str = Field(default='/mntS3', description="集群S3存储桶挂载在本地的根目录")
    S3_cdn_endpoint: str = Field(default="https://d2nj71io21vkj2.cloudfront.net",
                                 description="集群挂载S3存储桶的对应AWS Cloudfront CDN")
    modal_kv_name: str = Field(default='media-cache', description="Modal视频缓存KV库")
    modal_product_kv_name: str = Field(default='live-product-cache', description="Modal抖音直播间商品缓存KV库")
    modal_environment: str = Field(default="dev", description="Modal worker运行环境")
    modal_app_name: str = Field(default='bowong-ai-video', description="Modal App集群名称")
    comfyui_s3_input: Optional[str] = Field(default="comfyui-input", description="ComfyUI input S3文件夹名")
    comfyui_s3_output: Optional[str] = Field(default="comfyui-output", description="ComfyUI output S3文件夹名")

    modal_config: Any = SettingsConfigDict()
