# 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 .datasource_record_field_filter import DatasourceRecordFieldFilter


class QueryDatasourceRecordRequestBody(object):
    _types = {
        "source_code": str,
        "selected_fields": List[str],
        "field_filters": List[DatasourceRecordFieldFilter],
    }

    def __init__(self, d=None):
        self.source_code: Optional[str] = None
        self.selected_fields: Optional[List[str]] = None
        self.field_filters: Optional[List[DatasourceRecordFieldFilter]] = None
        init(self, d, self._types)

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


class QueryDatasourceRecordRequestBodyBuilder(object):
    def __init__(self) -> None:
        self._query_datasource_record_request_body = QueryDatasourceRecordRequestBody()

    def source_code(self, source_code: str) -> "QueryDatasourceRecordRequestBodyBuilder":
        self._query_datasource_record_request_body.source_code = source_code
        return self

    def selected_fields(self, selected_fields: List[str]) -> "QueryDatasourceRecordRequestBodyBuilder":
        self._query_datasource_record_request_body.selected_fields = selected_fields
        return self

    def field_filters(self,
                      field_filters: List[DatasourceRecordFieldFilter]) -> "QueryDatasourceRecordRequestBodyBuilder":
        self._query_datasource_record_request_body.field_filters = field_filters
        return self

    def build(self) -> "QueryDatasourceRecordRequestBody":
        return self._query_datasource_record_request_body
