import asyncio
from dataclasses import dataclass
from typing import Any


@dataclass
class ResultModel:
    code: int
    data: Any = None
    message: str = ""


class ResultEvent:
    def __init__(self):
        self.event = asyncio.Event()
        self.result = None

    async def wait(self):
        await self.event.wait()
        return self.result

    def set(self, result):
        self.result = result
        self.event.set()
