from dataclasses import dataclass
from typing import Optional

from ._PropertyModel import PropertyModel
from ._SchemaModel import SchemaModel
from ._SchemaPropertyTypeEnum import SchemaPropertyTypeEnum


@dataclass
class SchemaArrayPropertyModel(PropertyModel, SchemaModel):
    item: PropertyModel
    description: Optional[str] = None

    def to_dict(self) -> dict:
        return {
            "type": SchemaPropertyTypeEnum.array,
            "items": self.item,
        }
