# 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 .doc_res_unit import DocResUnit


class DocResponse(object):
    _types = {
        "total": int,
        "has_more": bool,
        "res_units": List[DocResUnit],
        "pagination_token": str,
    }

    def __init__(self, d=None):
        self.total: Optional[int] = None
        self.has_more: Optional[bool] = None
        self.res_units: Optional[List[DocResUnit]] = None
        self.pagination_token: Optional[str] = None
        init(self, d, self._types)

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


class DocResponseBuilder(object):
    def __init__(self) -> None:
        self._doc_response = DocResponse()

    def total(self, total: int) -> "DocResponseBuilder":
        self._doc_response.total = total
        return self

    def has_more(self, has_more: bool) -> "DocResponseBuilder":
        self._doc_response.has_more = has_more
        return self

    def res_units(self, res_units: List[DocResUnit]) -> "DocResponseBuilder":
        self._doc_response.res_units = res_units
        return self

    def pagination_token(self, pagination_token: str) -> "DocResponseBuilder":
        self._doc_response.pagination_token = pagination_token
        return self

    def build(self) -> "DocResponse":
        return self._doc_response
