from fastapi import APIRouter, Depends
from sqlalchemy.ext.asyncio import AsyncSession
from app.db.session import get_db
from app.schemas.social import ServiceProviderCreate, ServiceProviderResponse
from app.services.social_service import create_service_provider
from app.api import deps

router = APIRouter()

# Secured endpoint: Closed premium ecosystem
@router.post("/", response_model=ServiceProviderResponse)
async def add_provider(
    provider_data: ServiceProviderCreate,
    db: AsyncSession = Depends(get_db),
    current_user = Depends(deps.get_current_user)
):
    user_id = current_user.id
    return await create_service_provider(db, provider_data, user_id)