# 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 .okr_progress_rate import OkrProgressRate
from .okr_objective_kr import OkrObjectiveKr


class OkrObjective(object):
    _types = {
        "id": str,
        "content": str,
        "score": int,
        "weight": float,
        "progress_rate": OkrProgressRate,
        "key_results": List[OkrObjectiveKr],
        "category_id": str,
    }

    def __init__(self, d=None):
        self.id: Optional[str] = None
        self.content: Optional[str] = None
        self.score: Optional[int] = None
        self.weight: Optional[float] = None
        self.progress_rate: Optional[OkrProgressRate] = None
        self.key_results: Optional[List[OkrObjectiveKr]] = None
        self.category_id: Optional[str] = None
        init(self, d, self._types)

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


class OkrObjectiveBuilder(object):
    def __init__(self) -> None:
        self._okr_objective = OkrObjective()

    def id(self, id: str) -> "OkrObjectiveBuilder":
        self._okr_objective.id = id
        return self

    def content(self, content: str) -> "OkrObjectiveBuilder":
        self._okr_objective.content = content
        return self

    def score(self, score: int) -> "OkrObjectiveBuilder":
        self._okr_objective.score = score
        return self

    def weight(self, weight: float) -> "OkrObjectiveBuilder":
        self._okr_objective.weight = weight
        return self

    def progress_rate(self, progress_rate: OkrProgressRate) -> "OkrObjectiveBuilder":
        self._okr_objective.progress_rate = progress_rate
        return self

    def key_results(self, key_results: List[OkrObjectiveKr]) -> "OkrObjectiveBuilder":
        self._okr_objective.key_results = key_results
        return self

    def category_id(self, category_id: str) -> "OkrObjectiveBuilder":
        self._okr_objective.category_id = category_id
        return self

    def build(self) -> "OkrObjective":
        return self._okr_objective
