from snek.system.model import BaseModel, ModelField


class DriveModel(BaseModel):

    user_uid = ModelField(name="user_uid", required=True)
    name = ModelField(name="name", required=False, type=str)

    @property
    async def items(self):
        async for drive_item in self.app.services.drive_item.find(
            drive_uid=self["uid"]
        ):
            yield drive_item
