# Code generated by Lark OpenAPI.

from typing import Optional

from lark_oapi.core.construct import init


class Sort(object):
    _types = {
        "field_name": str,
        "desc": bool,
    }

    def __init__(self, d=None):
        self.field_name: Optional[str] = None
        self.desc: Optional[bool] = None
        init(self, d, self._types)

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


class SortBuilder(object):
    def __init__(self) -> None:
        self._sort = Sort()

    def field_name(self, field_name: str) -> "SortBuilder":
        self._sort.field_name = field_name
        return self

    def desc(self, desc: bool) -> "SortBuilder":
        self._sort.desc = desc
        return self

    def build(self) -> "Sort":
        return self._sort
