# Code generated by Lark OpenAPI.

from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type
from lark_oapi.core.construct import init
from .i18n import I18n
from .i18n import I18n
from .metric_dimension import MetricDimension
from .metric_in_template import MetricInTemplate
from .metric_group import MetricGroup


class MetricTemplate(object):
    _types = {
        "id": int,
        "name": I18n,
        "description": I18n,
        "status": str,
        "is_set_by_group": bool,
        "total_metric_score_method": str,
        "metric_weight_method": str,
        "metric_dimensions": List[MetricDimension],
        "metrics": List[MetricInTemplate],
        "groups": List[MetricGroup],
    }

    def __init__(self, d=None):
        self.id: Optional[int] = None
        self.name: Optional[I18n] = None
        self.description: Optional[I18n] = None
        self.status: Optional[str] = None
        self.is_set_by_group: Optional[bool] = None
        self.total_metric_score_method: Optional[str] = None
        self.metric_weight_method: Optional[str] = None
        self.metric_dimensions: Optional[List[MetricDimension]] = None
        self.metrics: Optional[List[MetricInTemplate]] = None
        self.groups: Optional[List[MetricGroup]] = None
        init(self, d, self._types)

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


class MetricTemplateBuilder(object):
    def __init__(self) -> None:
        self._metric_template = MetricTemplate()

    def id(self, id: int) -> "MetricTemplateBuilder":
        self._metric_template.id = id
        return self

    def name(self, name: I18n) -> "MetricTemplateBuilder":
        self._metric_template.name = name
        return self

    def description(self, description: I18n) -> "MetricTemplateBuilder":
        self._metric_template.description = description
        return self

    def status(self, status: str) -> "MetricTemplateBuilder":
        self._metric_template.status = status
        return self

    def is_set_by_group(self, is_set_by_group: bool) -> "MetricTemplateBuilder":
        self._metric_template.is_set_by_group = is_set_by_group
        return self

    def total_metric_score_method(self, total_metric_score_method: str) -> "MetricTemplateBuilder":
        self._metric_template.total_metric_score_method = total_metric_score_method
        return self

    def metric_weight_method(self, metric_weight_method: str) -> "MetricTemplateBuilder":
        self._metric_template.metric_weight_method = metric_weight_method
        return self

    def metric_dimensions(self, metric_dimensions: List[MetricDimension]) -> "MetricTemplateBuilder":
        self._metric_template.metric_dimensions = metric_dimensions
        return self

    def metrics(self, metrics: List[MetricInTemplate]) -> "MetricTemplateBuilder":
        self._metric_template.metrics = metrics
        return self

    def groups(self, groups: List[MetricGroup]) -> "MetricTemplateBuilder":
        self._metric_template.groups = groups
        return self

    def build(self) -> "MetricTemplate":
        return self._metric_template
