from sqlalchemy.dialects.postgresql import UUID
import uuid

import Models
from app import db


class ReactionModel(Models.Base):
    __tablename__ = 'reaction'

    id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
    emoji = db.Column(db.String, nullable=False, default="👍")
    post_id = db.Column(db.ForeignKey('post.id'), nullable=False)
    post = db.relationship(
        "PostModel"
    )
    user_id = db.Column(db.ForeignKey('user.id'), nullable=False)
    user = db.relationship(
        "UserModel"
    )

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
