import Models
from app import db
from sqlalchemy.dialects.postgresql import UUID
import uuid


class InviteModel(Models.Base):
    __tablename__ = 'invites'

    id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
    ignored = db.Column(db.Boolean, nullable=False, default=False)
    inviter_id = db.Column(db.ForeignKey('user.id'))
    inviter = db.relationship(
        "UserModel",
        foreign_keys=inviter_id
    )
    invitee_id = db.Column(db.ForeignKey('user.id'))
    invitee = db.relationship(
        "UserModel",
        foreign_keys=invitee_id
    )
    project_id = db.Column(db.ForeignKey('project.id'))
    project = db.relationship(
        "ProjectModel",
        foreign_keys=project_id,
        back_populates="invites"
    )
