# Path: invenio_communities/communities/records/models.py
# class CommunityMetadata(db.Model, RecordMetadataBase):
#     """Represent a community."""
# 
#     __tablename__ = 'communities_metadata'
# 
#     # Enables SQLAlchemy-Continuum versioning
#     __versioned__ = {}
# 
#     bucket_id = db.Column(UUIDType, db.ForeignKey(Bucket.id))
#     bucket = db.relationship(Bucket)


import uuid
from invenio_db import db
from invenio_accounts.models import User
from invenio_records.models import RecordMetadataBase
from sqlalchemy_utils.types import UUIDType
from ...communities.records.models import CommunityMetadata
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 Northwestern University.
#
# Invenio-Communities is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.

"""Member Model."""





class MemberModel(db.Model, RecordMetadataBase):
    """Member model."""

    __tablename__ = "communities_members"

    id = db.Column(UUIDType, primary_key=True, default=uuid.uuid4)

    community_id = db.Column(
        UUIDType,

# Path: invenio_communities/communities/records/models.py
# class CommunityMetadata(db.Model, RecordMetadataBase):
#     """Represent a community."""
# 
#     __tablename__ = 'communities_metadata'
# 
#     # Enables SQLAlchemy-Continuum versioning
#     __versioned__ = {}
# 
#     bucket_id = db.Column(UUIDType, db.ForeignKey(Bucket.id))
#     bucket = db.relationship(Bucket)


# Path: invenio_communities/members/records/models.py
import uuid
from invenio_db import db
from invenio_accounts.models import User
from invenio_records.models import RecordMetadataBase
from sqlalchemy_utils.types import UUIDType
from ...communities.records.models import CommunityMetadata

# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 Northwestern University.
#
# Invenio-Communities is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.

"""Member Model."""





class MemberModel(db.Model, RecordMetadataBase):
    """Member model."""

    __tablename__ = "communities_members"

    id = db.Column(UUIDType, primary_key=True, default=uuid.uuid4)

    community_id = db.Column(
        UUIDType,

        db.ForeignKey(CommunityMetadata.id, ondelete="CASCADE"),