"""Rotate ack message."""
from marshmallow import EXCLUDE, ValidationError, pre_dump
from ....notification.v1_0.messages.ack import V10Ack, V10AckSchema
from ..message_types import ACK, PROTOCOL_PACKAGE
HANDLER_CLASS = f"{PROTOCOL_PACKAGE}.handlers.ack_handler.RotateAckHandler"
[docs]class RotateAck(V10Ack):
"""Rotate ack."""
def __init__(self, **kwargs):
"""Initialize rotate ack object."""
super().__init__(**kwargs)
[docs]class RotateAckSchema(V10AckSchema):
"""Rotate ack schema."""
@pre_dump
def check_thread_deco(self, obj, **kwargs):
"""Thread decorator, and its thid, are mandatory."""
if not obj._decorators.to_dict().get("~thread", {}).keys() >= {"thid"}:
raise ValidationError("Missing required field(s) in thread decorator")
return obj