# Path: invenio_communities/proxies.py

# 
# Path: invenio_communities/invitations/services/schemas.py
# class MemberInvitationPayloadSchema(RequestSchema):
#     """Community Member Invitation Schema."""
# 
#     role = fields.String(required=True)
# 
#     @validates("role")
#     def validate_role(self, value):
#         """Validate role."""
#         return validate.OneOf(ROLE_TYPES)


from flask_babelex import lazy_gettext as _
from invenio_requests.customizations import RequestAction, RequestState, \
    BaseRequestType
from ...proxies import current_communities
from .schemas import MemberInvitationPayloadSchema

        super().execute(identity, uow)


# Request types

class CommunityMemberInvitation(BaseRequestType):
    """Community member invitation request type."""

    type_id = 'community-member-invitation'
    name = _('Community Member Invitation')
    available_statuses = {
        "open": RequestState.OPEN,
        "cancelled": RequestState.CLOSED,
        "declined": RequestState.CLOSED,
        "accepted": RequestState.CLOSED,
        "expired": RequestState.CLOSED,
    }
    default_status = "open"
    available_actions = {
        "accept": AcceptAction,
        # "cancel": CancelAction,
        # "decline": DeclineAction,
        # "expire": ExpireAction,
    }
    creator_can_be_none = False
    topic_can_be_none = False
    allowed_creator_ref_types = ["community"]
    allowed_receiver_ref_types = ["user"]
    allowed_topic_ref_types = ["community"]

# Path: invenio_communities/proxies.py

# 
# Path: invenio_communities/invitations/services/schemas.py
# class MemberInvitationPayloadSchema(RequestSchema):
#     """Community Member Invitation Schema."""
# 
#     role = fields.String(required=True)
# 
#     @validates("role")
#     def validate_role(self, value):
#         """Validate role."""
#         return validate.OneOf(ROLE_TYPES)


# Path: invenio_communities/invitations/services/request_types.py
from flask_babelex import lazy_gettext as _
from invenio_requests.customizations import RequestAction, RequestState, \
    BaseRequestType
from ...proxies import current_communities
from .schemas import MemberInvitationPayloadSchema


        super().execute(identity, uow)


# Request types

class CommunityMemberInvitation(BaseRequestType):
    """Community member invitation request type."""

    type_id = 'community-member-invitation'
    name = _('Community Member Invitation')
    available_statuses = {
        "open": RequestState.OPEN,
        "cancelled": RequestState.CLOSED,
        "declined": RequestState.CLOSED,
        "accepted": RequestState.CLOSED,
        "expired": RequestState.CLOSED,
    }
    default_status = "open"
    available_actions = {
        "accept": AcceptAction,
        # "cancel": CancelAction,
        # "decline": DeclineAction,
        # "expire": ExpireAction,
    }
    creator_can_be_none = False
    topic_can_be_none = False
    allowed_creator_ref_types = ["community"]
    allowed_receiver_ref_types = ["user"]
    allowed_topic_ref_types = ["community"]

    payload_schema = MemberInvitationPayloadSchema().fields