# 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 .criterion import Criterion
from .order_condition import OrderCondition


class SearchObjectParam(object):
    _types = {
        "api_name": str,
        "search_fields": List[str],
        "select": List[str],
        "filter": Criterion,
        "order_by": OrderCondition,
    }

    def __init__(self, d=None):
        self.api_name: Optional[str] = None
        self.search_fields: Optional[List[str]] = None
        self.select: Optional[List[str]] = None
        self.filter: Optional[Criterion] = None
        self.order_by: Optional[OrderCondition] = None
        init(self, d, self._types)

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


class SearchObjectParamBuilder(object):
    def __init__(self) -> None:
        self._search_object_param = SearchObjectParam()

    def api_name(self, api_name: str) -> "SearchObjectParamBuilder":
        self._search_object_param.api_name = api_name
        return self

    def search_fields(self, search_fields: List[str]) -> "SearchObjectParamBuilder":
        self._search_object_param.search_fields = search_fields
        return self

    def select(self, select: List[str]) -> "SearchObjectParamBuilder":
        self._search_object_param.select = select
        return self

    def filter(self, filter: Criterion) -> "SearchObjectParamBuilder":
        self._search_object_param.filter = filter
        return self

    def order_by(self, order_by: OrderCondition) -> "SearchObjectParamBuilder":
        self._search_object_param.order_by = order_by
        return self

    def build(self) -> "SearchObjectParam":
        return self._search_object_param
