# 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 Metric(object):
    _types = {
        "name": str,
        "type": str,
        "value": float,
        "attributes": str,
        "timestamp": int,
    }

    def __init__(self, d=None):
        self.name: Optional[str] = None
        self.type: Optional[str] = None
        self.value: Optional[float] = None
        self.attributes: Optional[str] = None
        self.timestamp: Optional[int] = None
        init(self, d, self._types)

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


class MetricBuilder(object):
    def __init__(self) -> None:
        self._metric = Metric()

    def name(self, name: str) -> "MetricBuilder":
        self._metric.name = name
        return self

    def type(self, type: str) -> "MetricBuilder":
        self._metric.type = type
        return self

    def value(self, value: float) -> "MetricBuilder":
        self._metric.value = value
        return self

    def attributes(self, attributes: str) -> "MetricBuilder":
        self._metric.attributes = attributes
        return self

    def timestamp(self, timestamp: int) -> "MetricBuilder":
        self._metric.timestamp = timestamp
        return self

    def build(self) -> "Metric":
        return self._metric
