# Code generated by Lark OpenAPI.

from typing import Optional, List

from lark_oapi.core.construct import init
from .abnormal_reason_i18n_element import AbnormalReasonI18nElement


class AbnormalReason(object):
    _types = {
        "id": str,
        "type": int,
        "i18n_elements": List[AbnormalReasonI18nElement],
    }

    def __init__(self, d=None):
        self.id: Optional[str] = None
        self.type: Optional[int] = None
        self.i18n_elements: Optional[List[AbnormalReasonI18nElement]] = None
        init(self, d, self._types)

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


class AbnormalReasonBuilder(object):
    def __init__(self) -> None:
        self._abnormal_reason = AbnormalReason()

    def id(self, id: str) -> "AbnormalReasonBuilder":
        self._abnormal_reason.id = id
        return self

    def type(self, type: int) -> "AbnormalReasonBuilder":
        self._abnormal_reason.type = type
        return self

    def i18n_elements(self, i18n_elements: List[AbnormalReasonI18nElement]) -> "AbnormalReasonBuilder":
        self._abnormal_reason.i18n_elements = i18n_elements
        return self

    def build(self) -> "AbnormalReason":
        return self._abnormal_reason
