
from django import forms
from .models import EcUser, ContactInfo, SchoolInfo, AcademicInfo, HealthInfo,  SelfEvaluation
from .models import HobbiesInterests, SocialPractice, FamilyInfo, AwardsPunishments

class BaiscInfoForm(forms.ModelForm):
    class Meta:
        model = EcUser
        fields = ['name', 'gender', 'age', 'ethnicity', 'dob', 'id_card_number', 'political_status']

class ContactInfoForm(forms.ModelForm):
    class Meta:
        model = ContactInfo
        fields = ['home_address', 'parent_contact', 'student_contact', 'email']

# SchoolInfo 表单
class SchoolInfoForm(forms.ModelForm):
    class Meta:
        model = SchoolInfo
        fields = ['school_name', 'grade', 'class_name', 'admission_date', 'expected_graduation_date']

# AcademicInfo 表单
class AcademicInfoForm(forms.ModelForm):
    class Meta:
        model = AcademicInfo
        fields = ['last_semester_score', 'this_semester_score', 'class_ranking', 'strong_subject', 'weak_subject']

# HealthInfo 表单
class HealthInfoForm(forms.ModelForm):
    class Meta:
        model = HealthInfo
        fields = ['height', 'weight', 'blood_type', 'medical_history', 'disability_status', 'disability_category', 'disability_grade']

# SelfEvaluation 表单
class SelfEvaluationForm(forms.ModelForm):
    class Meta:
        model = SelfEvaluation
        fields = ['strengths', 'weaknesses', 'study_attitude', 'future_plans']

# HobbiesInterests 表单
class HobbiesInterestsForm(forms.ModelForm):
    class Meta:
        model = HobbiesInterests
        fields = ['interests', 'extracurricular_activities']

# SocialPractice 表单
class SocialPracticeForm(forms.ModelForm):
    class Meta:
        model = SocialPractice
        fields = ['activity_name', 'activity_date', 'activity_location', 'activity_description', 'activity_outcome']

# FamilyInfo 表单
class FamilyInfoForm(forms.ModelForm):
    class Meta:
        model = FamilyInfo
        fields = ['family_member', 'economic_status']

# AwardsPunishments 表单
class AwardsPunishmentsForm(forms.ModelForm):
    class Meta:
        model = AwardsPunishments
        fields = ['award_name', 'award_date', 'award_organization', 'discipline_date', 'discipline_issue', 'discipline_outcome']


# 获取或创建各个信息模型实例
g_models = {
    'contact_info': ContactInfo,
    'school_info': SchoolInfo,
    'academic_info': AcademicInfo,
    'health_info': HealthInfo,
    'self_evaluation': SelfEvaluation,
    'hobbies_interests': HobbiesInterests,
    'social_practice': SocialPractice,
    'family_info': FamilyInfo,
    'awards_punishments': AwardsPunishments
}

g_form_classes = {
    'contact_info_form': ContactInfoForm,
    'school_info_form': SchoolInfoForm,
    'academic_info_form': AcademicInfoForm,
    'health_info_form': HealthInfoForm,
    'self_evaluation_form': SelfEvaluationForm,
    'hobbies_interests_form': HobbiesInterestsForm,
    'social_practice_form': SocialPracticeForm,
    'family_info_form': FamilyInfoForm,
    'awards_punishments_form': AwardsPunishmentsForm
}
