from sqlmodel import Session, select
from app.core.database import engine
from app.models.business import Business

def seed_tourist_spots():
    spots = [
        {
            "name": "Mi Jardín es Su Jardín",
            "category": "Area Turistica",
            "address": "Entrada de Boquete",
            "phone": "+507 720-1234",
            "latitude": 8.7770,
            "longitude": -82.4330,
            "social_media": "@jardin_boquete",
            "image_url": "/uploads/mijardin.jpg"
        },
        {
            "name": "Boquete Brewing Company",
            "category": "Bebidas",
            "address": "Calle Principal, Boquete",
            "phone": "+507 720-5678",
            "latitude": 8.7760,
            "longitude": -82.4350,
            "social_media": "@boquetebrewing",
            "image_url": "/uploads/brewing.jpg"
        },
        {
            "name": "CEFATI - Info Turística",
            "category": "Area Turistica",
            "address": "Bajo Boquete",
            "phone": "+507 720-9999",
            "latitude": 8.7690,
            "longitude": -82.4300,
            "social_media": "@turismoboquete",
            "image_url": "/uploads/cefati.jpg"
        },
        {
            "name": "Kotowa Coffee House",
            "category": "Restaurante",
            "address": "Plaza Los Delfines",
            "phone": "+507 720-4444",
            "latitude": 8.7775,
            "longitude": -82.4325,
            "social_media": "@kotowacoffee",
            "image_url": "/uploads/kotowa.jpg"
        },
        {
            "name": "Biblioteca de Boquete",
            "category": "Area Turistica",
            "address": "Av. Central",
            "phone": "+507 720-1111",
            "latitude": 8.7765,
            "longitude": -82.4310,
            "social_media": "@biblio_boquete",
            "image_url": "/uploads/biblioteca.jpg"
        }
    ]

    with Session(engine) as session:
        for spot_data in spots:
            # Check if exists
            existing = session.exec(select(Business).where(Business.name == spot_data["name"])).first()
            if not existing:
                business = Business(**spot_data)
                session.add(business)
        session.commit()
        print("Tourist spots seeded successfully!")

if __name__ == "__main__":
    seed_tourist_spots()
