from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from app.api.landing_page import schema
from app.api.landing_page.service import LandingPageService
from app.database.main.mysql import get_db
from app.dependency.authantication import JWTPayloadSchema, get_current_student

landing_page_router = APIRouter()

@landing_page_router.post("/create_landing_page", response_model_exclude_none=True)
async def create_landing_page(request:schema.LandingPageCreate, db:Session = Depends(get_db), token:JWTPayloadSchema = Depends(get_current_student)):
    return await LandingPageService(db,token).created(request)

@landing_page_router.get("/get_landing_page{landing_id}", response_model_exclude_none=True)
async def get_landing_page(landing_id:int, db:Session = Depends(get_db), token:JWTPayloadSchema = Depends(get_current_student)):
    return await LandingPageService(db,token).geted(landing_id)