from app.models import Contact
from app.schemas import ContactCreate

async def create_contact(db, contact_data: ContactCreate) -> Contact:
    # Exclude recaptcha_token as it's not part of Contact model
    contact_dict = contact_data.model_dump(exclude={"recaptcha_token"})
    contact = Contact(**contact_dict)
    db.add(contact)
    await db.commit()
    await db.refresh(contact)
    return contact
