# Code generated by Lark OpenAPI.

from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type
from lark_oapi.core.construct import init


class Event(object):
    _types = {
        "id": str,
        "type": str,
        "start_timestamp": int,
        "end_timestamp": int,
        "is_finished": bool,
        "trace_id": str,
        "detail": str,
        "attributes": str,
    }

    def __init__(self, d=None):
        self.id: Optional[str] = None
        self.type: Optional[str] = None
        self.start_timestamp: Optional[int] = None
        self.end_timestamp: Optional[int] = None
        self.is_finished: Optional[bool] = None
        self.trace_id: Optional[str] = None
        self.detail: Optional[str] = None
        self.attributes: Optional[str] = None
        init(self, d, self._types)

    @staticmethod
    def builder() -> "EventBuilder":
        return EventBuilder()


class EventBuilder(object):
    def __init__(self) -> None:
        self._event = Event()

    def id(self, id: str) -> "EventBuilder":
        self._event.id = id
        return self

    def type(self, type: str) -> "EventBuilder":
        self._event.type = type
        return self

    def start_timestamp(self, start_timestamp: int) -> "EventBuilder":
        self._event.start_timestamp = start_timestamp
        return self

    def end_timestamp(self, end_timestamp: int) -> "EventBuilder":
        self._event.end_timestamp = end_timestamp
        return self

    def is_finished(self, is_finished: bool) -> "EventBuilder":
        self._event.is_finished = is_finished
        return self

    def trace_id(self, trace_id: str) -> "EventBuilder":
        self._event.trace_id = trace_id
        return self

    def detail(self, detail: str) -> "EventBuilder":
        self._event.detail = detail
        return self

    def attributes(self, attributes: str) -> "EventBuilder":
        self._event.attributes = attributes
        return self

    def build(self) -> "Event":
        return self._event
