from typing import Literal

from ..base import BaseModel


class EncodedTextChunk(BaseModel):
    tokens: list[int]
    type: Literal["encoded_text"] = "encoded_text"

    def to_ints(self) -> list[int]:
        return list(self.tokens)

    @property
    def length(self) -> int:
        return len(self)

    def __len__(self) -> int:
        return len(self.tokens)
