#   Copyright 2021 Modelyst LLC
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

from typing import AbstractSet, Any, Dict, Mapping, Optional, Sequence, Union

from pydantic.fields import Undefined, UndefinedType
from sqlalchemy import Column
from sqlmodel import Field

from dbgen.utils.typing import NoArgAnyCallable


def Attribute(
    default: Any = Undefined,
    *,
    default_factory: Optional[NoArgAnyCallable] = None,
    alias: str = None,
    title: str = None,
    description: str = None,
    exclude: Union[AbstractSet[Union[int, str]], Mapping[Union[int, str], Any], Any] = None,
    include: Union[AbstractSet[Union[int, str]], Mapping[Union[int, str], Any], Any] = None,
    const: bool = None,
    gt: float = None,
    ge: float = None,
    lt: float = None,
    le: float = None,
    multiple_of: float = None,
    min_items: int = None,
    max_items: int = None,
    min_length: int = None,
    max_length: int = None,
    allow_mutation: bool = True,
    regex: str = None,
    primary_key: bool = False,
    foreign_key: Optional[Any] = None,
    nullable: Union[bool, UndefinedType] = Undefined,
    index: Union[bool, UndefinedType] = Undefined,
    sa_column: Union[Column, UndefinedType] = Undefined,
    sa_column_args: Union[Sequence[Any], UndefinedType] = Undefined,
    sa_column_kwargs: Union[Mapping[str, Any], UndefinedType] = Undefined,
    schema_extra: Optional[Dict[str, Any]] = None,
) -> Any:

    field = Field(
        default,
        default_factory=default_factory,
        alias=alias,
        title=title,
        description=description,
        exclude=exclude,
        include=include,
        const=const,
        gt=gt,
        ge=ge,
        lt=lt,
        le=le,
        multiple_of=multiple_of,
        min_items=min_items,
        max_items=max_items,
        min_length=min_length,
        max_length=max_length,
        allow_mutation=allow_mutation,
        regex=regex,
        primary_key=primary_key,
        foreign_key=foreign_key,
        nullable=nullable,
        index=index,
        sa_column=sa_column,
        sa_column_args=sa_column_args,
        sa_column_kwargs=sa_column_kwargs,
        schema_extra=schema_extra,
    )
    return field

sqlmodel.Field
[((1965, 2523), 'sqlmodel.Field', 'Field', (['default'], {'default_factory': 'default_factory', 'alias': 'alias', 'title': 'title', 'description': 'description', 'exclude': 'exclude', 'include': 'include', 'const': 'const', 'gt': 'gt', 'ge': 'ge', 'lt': 'lt', 'le': 'le', 'multiple_of': 'multiple_of', 'min_items': 'min_items', 'max_items': 'max_items', 'min_length': 'min_length', 'max_length': 'max_length', 'allow_mutation': 'allow_mutation', 'regex': 'regex', 'primary_key': 'primary_key', 'foreign_key': 'foreign_key', 'nullable': 'nullable', 'index': 'index', 'sa_column': 'sa_column', 'sa_column_args': 'sa_column_args', 'sa_column_kwargs': 'sa_column_kwargs', 'schema_extra': 'schema_extra'}), '(default, default_factory=default_factory, alias=alias, title=title,\n    description=description, exclude=exclude, include=include, const=const,\n    gt=gt, ge=ge, lt=lt, le=le, multiple_of=multiple_of, min_items=\n    min_items, max_items=max_items, min_length=min_length, max_length=\n    max_length, allow_mutation=allow_mutation, regex=regex, primary_key=\n    primary_key, foreign_key=foreign_key, nullable=nullable, index=index,\n    sa_column=sa_column, sa_column_args=sa_column_args, sa_column_kwargs=\n    sa_column_kwargs, schema_extra=schema_extra)\n', (1970, 2523), False, 'from sqlmodel import Field\n')]