from bolinette import types, core, mapping
from bolinette.decorators import model


@model('{{ name }}')
class {{ class }}(core.Model):
    id = types.defs.Column(types.db.Integer, primary_key=True)
    uid = types.defs.Column(types.db.String, unique=True, nullable=False, entity_key=True)
    name = types.defs.Column(types.db.String, nullable=False)

    def payloads(self):
        yield [
            mapping.Column(self.uid, required=True),
            mapping.Column(self.name, required=True)
        ]

    def responses(self):
        yield [
            mapping.Column(self.uid),
            mapping.Column(self.name)
        ]
