import sys, os
sys.path.insert(0, os.path.abspath("."))
from app import create_app, db
from app.models.activity_post import ActivityPost
from datetime import date

app = create_app()
with app.app_context():
    if ActivityPost.query.count() == 0:
        p1 = ActivityPost(
            title="Winter Relief Drive: 500 Blankets & Dry Ration Kits Distributed in Trilokpuri",
            caption=(
                "With the harsh winter approaching, our grassroots relief team distributed 500 high-grade wool blankets "
                "and dry ration packages containing wheat flour, rice, and pulses to marginalized families and widows in Trilokpuri. "
                "Special thanks to our 25 dedicated volunteer field workers who managed the drive with absolute statutory order."
            ),
            category="Relief Drive",
            activity_date=date.today(),
            location="Trilokpuri Cluster, East Delhi",
            primary_image_url="/static/images/banners/banner1.jpg",
            is_featured=True,
            likes_count=48,
            author_name="Mohammad Ajaz (Trustee)",
            status="published"
        )
        p2 = ActivityPost(
            title="Free Multi-Speciality Health & Diagnostic Camp in Bawana Community Center",
            caption=(
                "Over 350 senior citizens, mothers, and young children received free diagnostic health screenings, "
                "pediatric consultations, and essential prescribed medicines. 14 patients were also referred for specialized cataract care."
            ),
            category="Health & Blood Donation Camp",
            activity_date=date.today(),
            location="Community Hall, Bawana Sector 3, Delhi",
            primary_image_url="/static/images/banners/banner2.jpg",
            is_featured=False,
            likes_count=32,
            author_name="Rajkumar Maurya",
            status="published"
        )
        p3 = ActivityPost(
            title="Educational Kit Distribution for 200 Slum Children Under Shiksha Abhiyan",
            caption=(
                "Under our ongoing Education Pillar, comprehensive learning kits consisting of school bags, notebooks, geometry sets, "
                "and stationery were handed over to 200 primary students to encourage regular attendance and curb dropout rates."
            ),
            category="Education & School Support",
            activity_date=date.today(),
            location="JJ Basti, Shakurpur, New Delhi",
            primary_image_url="/static/images/banners/banner3.jpg",
            is_featured=False,
            likes_count=61,
            author_name="NGO Foundation Team",
            status="published"
        )
        db.session.add_all([p1, p2, p3])
        db.session.commit()
        print("Sample activity posts seeded successfully!")
    else:
        print("Activity posts already exist:", ActivityPost.query.count())
