from pydantic import BaseModel, Field


class LSTMParams(BaseModel):
    seq_len: int = Field(default=20, ge=5, le=500)
    hidden_size: int = Field(default=64, ge=8, le=1024)
    num_layers: int = Field(default=2, ge=1, le=8)
    epochs: int = Field(default=50, ge=1, le=2000)
    batch_size: int = Field(default=32, ge=1, le=512)
    learning_rate: float = Field(default=0.001, gt=0, le=1)


class CreateTaskRequest(BaseModel):
    model_name: str = Field(min_length=1, max_length=255)
    train_package_id: int
    val_package_id: int
    params: LSTMParams = Field(default_factory=LSTMParams)


class SaveModelRequest(BaseModel):
    model_name: str | None = Field(default=None, max_length=255)
    description: str | None = None


class UpdateModelRequest(BaseModel):
    model_name: str | None = Field(default=None, max_length=255)
    description: str | None = None
