from sqlalchemy.dialects.postgresql import UUID
import uuid

import Models
from app import db


class MediaLikesModel(Models.Base):
    __tablename__ = 'media_likes'

    id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
    media_id = db.Column(db.ForeignKey('media.id'), nullable=False)
    media = db.relationship(
        "MediaModel"
    )
    user_id = db.Column(db.ForeignKey('user.id'), nullable=False)
    user = db.relationship(
        "UserModel"
    )

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