from flask_pymongo import PyMongo


def seed_subjects(mongo: PyMongo):
    subject_collection = mongo.db.subjects

    base_subjects = [
        {
            "name": "Ilmu Pengetahuan Alam",
            "short_name": "IPA",
            "description": "Pelajaran tentang sains dan alam",
        },
        {
            "name": "Ilmu Pengetahuan Sosial",
            "short_name": "IPS",
            "description": "Pelajaran tentang masyarakat dan geografi",
        },
        {
            "name": "Sejarah",
            "short_name": "Sejarah",
            "description": "Pelajaran mengenai sejarah di indonesia",
        },
        {
            "name": "Matematika",
            "short_name": "Matematika",
            "description": "Pelajaran tentang angka dan logika",
        },
        {
            "name": "Bahasa Indonesia",
            "short_name": "B.Indonesia",
            "description": "Pelajaran tentang bahasa nasional",
        },
        {
            "name": "Sejarah",
            "short_name": "Sejarah",
            "description": "Pelajaran sejarah Indonesia",
        },
    ]

    for subject in base_subjects:
        if not subject_collection.find_one({"name": subject["name"]}):
            subject_collection.insert_one(subject)
