# generated by datamodel-codegen:
#   filename:  openapi.json
#   timestamp: 2022-12-08T02:46:08+00:00

from __future__ import annotations

from typing import Any, List, Optional

from pydantic import BaseModel, Field

from models import common


class FieldData(BaseModel):
    field: Optional[Any] = Field(
        None,
        description='Types that are assignable to Field:\n\t*FieldData_Scalars\n\t*FieldData_Vectors',
    )
    field_id: Optional[int] = None
    field_name: Optional[str] = None
    type: Optional[int] = Field(
        None,
        description='0:   "None",\n1:   "Bool",\n2:   "Int8",\n3:   "Int16",\n4:   "Int32",\n5:   "Int64",\n10:  "Float",\n11:  "Double",\n20:  "String",\n21:  "VarChar",\n100: "BinaryVector",\n101: "FloatVector",',
    )


class FieldSchema(BaseModel):
    autoID: Optional[bool] = None
    data_type: int = Field(
        ...,
        description='0:   "None",\n1:   "Bool",\n2:   "Int8",\n3:   "Int16",\n4:   "Int32",\n5:   "Int64",\n10:  "Float",\n11:  "Double",\n20:  "String",\n21:  "VarChar",\n100: "BinaryVector",\n101: "FloatVector",',
        example=101,
    )
    description: Optional[str] = Field(
        None, example='embedded vector of book introduction'
    )
    fieldID: Optional[int] = None
    index_params: Optional[List[common.KeyValuePair]] = None
    is_primary_key: Optional[bool] = Field(None, example=False)
    name: str = Field(..., example='book_intro')
    type_params: Optional[List[common.KeyValuePair]] = None


class IDs(BaseModel):
    idField: Optional[Any] = Field(
        None,
        description='Types that are assignable to IdField:\n\t*IDs_IntId\n\t*IDs_StrId',
    )


class LongArray(BaseModel):
    data: Optional[List[int]] = None


class SearchResultData(BaseModel):
    fields_data: Optional[List[FieldData]] = None
    ids: Optional[IDs] = None
    num_queries: Optional[int] = None
    scores: Optional[List[float]] = None
    top_k: Optional[int] = None
    topks: Optional[List[int]] = None


class CollectionSchema(BaseModel):
    autoID: Optional[bool] = Field(
        None,
        description='deprecated later, keep compatible with c++ part now',
        example=False,
    )
    description: Optional[str] = Field(None, example='Test book search')
    fields: Optional[List[FieldSchema]] = None
    name: str = Field(..., example='book')
