from typing import List
from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from app.api.physical_store_formats import schema
from app.api.physical_store_formats.service import PhysicalStoreFormatsService
from app.database.main.mysql import get_db
from app.dependency.authantication import JWTPayloadSchema, get_current_student

physical_store_formats_router = APIRouter()

@physical_store_formats_router.post("/create_physical_store_formats", response_model_exclude_none=True)
async def create_physical_store_formats(request: List[schema.PhysicalStoreFormatsCreate],db: Session = Depends(get_db),token: JWTPayloadSchema = Depends(get_current_student)):
    return await PhysicalStoreFormatsService(db, token).created(request)

@physical_store_formats_router.get("/get_physical_store_formats/{group_id}",response_model_exclude_none=True)
async def get_physical_store_formats(group_id: int, db: Session =Depends(get_db),token: JWTPayloadSchema = Depends(get_current_student)):
    return await PhysicalStoreFormatsService(db,token).geted(group_id)

@physical_store_formats_router.put("/update_physical_store_formats", response_model_exclude_none=True)
async def update_physical_store_formats(request:List[schema.PhysicalStoreFormatsUpdate], db:Session = Depends(get_db),token: JWTPayloadSchema = Depends(get_current_student)):
    return await PhysicalStoreFormatsService(db,token).updated(request)

@physical_store_formats_router.delete("/delete_physical_store_formats", response_model_exclude_none=True)
async def delete_physical_store_formats(physical_id:int, db:Session = Depends(get_db),token: JWTPayloadSchema = Depends(get_current_student)):
    return await PhysicalStoreFormatsService(db,token).deleted(physical_id)
