# 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 RecordResultError(object):
    _types = {
        "code": str,
        "message": str,
        "sub_code": str,
        "fields": List[str],
    }

    def __init__(self, d=None):
        self.code: Optional[str] = None
        self.message: Optional[str] = None
        self.sub_code: Optional[str] = None
        self.fields: Optional[List[str]] = None
        init(self, d, self._types)

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


class RecordResultErrorBuilder(object):
    def __init__(self) -> None:
        self._record_result_error = RecordResultError()

    def code(self, code: str) -> "RecordResultErrorBuilder":
        self._record_result_error.code = code
        return self

    def message(self, message: str) -> "RecordResultErrorBuilder":
        self._record_result_error.message = message
        return self

    def sub_code(self, sub_code: str) -> "RecordResultErrorBuilder":
        self._record_result_error.sub_code = sub_code
        return self

    def fields(self, fields: List[str]) -> "RecordResultErrorBuilder":
        self._record_result_error.fields = fields
        return self

    def build(self) -> "RecordResultError":
        return self._record_result_error
