# 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 .record_result_error import RecordResultError


class RecordResult(object):
    _types = {
        "success": bool,
        "id": str,
        "errors": List[RecordResultError],
    }

    def __init__(self, d=None):
        self.success: Optional[bool] = None
        self.id: Optional[str] = None
        self.errors: Optional[List[RecordResultError]] = None
        init(self, d, self._types)

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


class RecordResultBuilder(object):
    def __init__(self) -> None:
        self._record_result = RecordResult()

    def success(self, success: bool) -> "RecordResultBuilder":
        self._record_result.success = success
        return self

    def id(self, id: str) -> "RecordResultBuilder":
        self._record_result.id = id
        return self

    def errors(self, errors: List[RecordResultError]) -> "RecordResultBuilder":
        self._record_result.errors = errors
        return self

    def build(self) -> "RecordResult":
        return self._record_result
