from pydantic import BaseModel, Field, field_validator


class OemCardKeyUpdate(BaseModel):
    oem_remark: str | None = Field(default=None, max_length=255)

    @field_validator("oem_remark")
    @classmethod
    def normalize_oem_remark(cls, value: str | None) -> str | None:
        if value is None:
            return None
        stripped = value.strip()
        return stripped or None


class OemCardKeyBatchAssign(BaseModel):
    card_ids: list[int] = Field(min_length=1, max_length=200)
    agent_id: int = Field(ge=1)


class OemCardKeyBatchAssignResult(BaseModel):
    updated_count: int
