# coding: utf-8
"""
    Cortex Search REST API

    OpenAPI 3.0 specification for the Cortex Search REST API  # noqa: E501

    The version of the OpenAPI document: 0.1.0
    Contact: support@snowflake.com
    Generated by: https://openapi-generator.tech

    Do not edit this file manually.
"""

from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from typing import Union

from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr

from typing import Any, ClassVar, Dict, List, Optional


class QueryRequest(BaseModel):

    query: StrictStr

    columns: List[StrictStr]

    filter: Optional[Dict[str, Any]] = None

    limit: Optional[StrictInt] = 10

    experimental: Optional[Dict[str, Any]] = None

    __properties = ["query", "columns", "filter", "limit", "experimental"]

    class Config:
        populate_by_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> QueryRequest:
        """Create an instance of QueryRequest from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = dict(
            self._iter(to_dict=True,
                       by_alias=True,
                       exclude={},
                       exclude_none=True))

        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> QueryRequest:
        """Create an instance of QueryRequest from a dict"""

        if obj is None:
            return None

        if type(obj) is not dict:
            return QueryRequest.parse_obj(obj)

        _obj = QueryRequest.parse_obj({
            "query":
            obj.get("query"),
            "columns":
            obj.get("columns"),
            "filter":
            obj.get("filter"),
            "limit":
            obj.get("limit") if obj.get("limit") is not None else 10,
            "experimental":
            obj.get("experimental"),
        })

        return _obj


from typing import Optional, List, Dict


class QueryRequestModel():

    def __init__(
        self,
        query: str,
        columns: List[str],
        # optional properties
        filter: Optional[object] = None,
        limit: Optional[int] = 10,
        experimental: Optional[object] = None,
    ):

        self.query = query
        self.columns = columns
        self.filter = filter
        self.limit = limit
        self.experimental = experimental

    __properties = ["query", "columns", "filter", "limit", "experimental"]

    def _to_model(self):
        return QueryRequest(
            query=self.query,
            columns=self.columns,
            filter=self.filter,
            limit=self.limit,
            experimental=self.experimental,
        )

    @classmethod
    def _from_model(cls, model) -> QueryRequestModel:
        return QueryRequestModel(
            query=model.query,
            columns=model.columns,
            filter=model.filter,
            limit=model.limit,
            experimental=model.experimental,
        )

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        return self._to_model().to_dict()

    @classmethod
    def from_dict(cls, obj: dict) -> QueryRequestModel:
        """Create an instance of QueryRequest from a dict"""
        return cls._from_model(QueryRequest.from_dict(obj))


QueryRequest._model_class = QueryRequestModel
