from app import db


class LovelaceURL(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    room_name = db.Column(db.String(120), nullable=False)
    url = db.Column(db.String(512), nullable=False)

    def to_dict(self):
        return {
            'id': self.id,
            'room_name': self.room_name,
            'url': self.url
        }

    def __repr__(self):
        return f'<LovelaceURL {self.id}: {self.room_name}>'


