#!/usr/bin/env python
"""
检查schema定义的字段
"""

import sys
from pathlib import Path

# 添加项目根目录到 Python 路径
project_root = Path(__file__).parent
sys.path.append(str(project_root))

from app.schemas.user import UserBase, UserInDBBase, User

def check_fields():
    """检查字段定义"""
    
    print("=== UserBase 字段 ===")
    for field_name, field_info in UserBase.model_fields.items():
        print(f"{field_name}: {field_info}")
    
    print("\n=== UserInDBBase 字段 ===")
    for field_name, field_info in UserInDBBase.model_fields.items():
        print(f"{field_name}: {field_info}")
    
    print("\n=== User 字段 ===")
    for field_name, field_info in User.model_fields.items():
        print(f"{field_name}: {field_info}")
    
    # 检查继承链
    print("\n=== 继承关系 ===")
    print(f"UserBase.__bases__: {UserBase.__bases__}")
    print(f"UserInDBBase.__bases__: {UserInDBBase.__bases__}")
    print(f"User.__bases__: {User.__bases__}")
    
    # 检查模型配置
    print("\n=== 模型配置 ===")
    if hasattr(UserBase, 'model_config'):
        print(f"UserBase.model_config: {UserBase.model_config}")
    if hasattr(UserInDBBase, 'model_config'):
        print(f"UserInDBBase.model_config: {UserInDBBase.model_config}")
    if hasattr(User, 'model_config'):
        print(f"User.model_config: {User.model_config}")

if __name__ == "__main__":
    check_fields()
