#   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 string import ascii_lowercase
from typing import Any, Dict, Tuple, Type, TypeVar
from uuid import UUID

from hypothesis import strategies as st
from hypothesis.strategies._internal.strategies import SearchStrategy
from sqlalchemy.orm import registry
from sqlmodel import Field

from dbgen.core.entity import BaseEntity, EntityMetaclass

protected_words = {"mro"}
uni_text = lambda x: st.text(ascii_lowercase, min_size=x)
non_private_attr = uni_text(1).filter(lambda x: x[0] != "_").filter(lambda x: x not in protected_words)
pydantic_type_strat = st.sampled_from((str, float, bool, int))

id_field = Field(
    default=None,
    primary_key=True,
    sa_column_kwargs={"autoincrement": False, "unique": True},
)
fk_field = lambda x: 