from fastapi.routing import APIRouter
from fastapi.requests import Request

from api_validations.validations_request import (
    DecisionBookDecisionBookInvitationsAttend,
    DecisionBookDecisionBookInvitationsAssign,
    PatchRecord,
)

from api_services.redis.auth_actions.token import parse_token_object_to_dict


build_decision_book_invitations = APIRouter(
    prefix="/build/decision_book/invitations", tags=["Decision Book Invitations"]
)
build_decision_book_invitations.include_router(
    build_decision_book_invitations, include_in_schema=True
)


@build_decision_book_invitations.post(
    path="/attend", summary="Decision Book Invitations Attend"
)
def build_decision_book_invitations_attend(
    request: Request, data: DecisionBookDecisionBookInvitationsAttend
):
    token_dict = parse_token_object_to_dict(request=request)
    return token_dict.available_event(data=data, token_dict=token_dict)


@build_decision_book_invitations.post(
    path="/assign", summary="Decision Book Invitations Assign"
)
def build_decision_book_invitations_assign(
    request: Request, data: DecisionBookDecisionBookInvitationsAssign
):
    token_dict = parse_token_object_to_dict(request=request)
    return token_dict.available_event(data=data, token_dict=token_dict)
