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

branding_attributes_router = APIRouter()

@branding_attributes_router.post("/create_branding_attributes", response_model_exclude_none=True)
async def create_branding_attributes(request:schema.BrandingAttributesCreate, db:Session = Depends(get_db), token:JWTPayloadSchema = Depends(get_current_student)):
    return await service.BrandingAttributesService(db,token).create_branding_attributes(request)

@branding_attributes_router.get("/get_branding_attributes/{group_id}", response_model_exclude_none=True)
async def get_branding_attributes(group_id:int, db:Session = Depends(get_db), token:JWTPayloadSchema = Depends(get_current_student)):
    return await service.BrandingAttributesService(db,token).get_branding_attributes(group_id)

@branding_attributes_router.put("/update_branding_attributes", response_model_exclude_none=True)
async def update_branding_attributes(request:List[schema.BrandingAttributesUpdate], db:Session = Depends(get_db), token:JWTPayloadSchema = Depends(get_current_student)):
    return await service.BrandingAttributesService(db,token).update_branding_attributes(request)

@branding_attributes_router.delete("/delete_branding_attributes", response_model_exclude_none=True)
async def delete_branding_attributes(brand_id:int, db:Session = Depends(get_db), token:JWTPayloadSchema = Depends(get_current_student)):
    return await service.BrandingAttributesService(db,token).delete_branding_attributes(brand_id)


@branding_attributes_router.get("/get_brand_attribute/{group_id}", response_model_exclude_none=True)
async def get_brand_attribute(group_id:int, db:Session = Depends(get_db), token:JWTPayloadSchema = Depends(get_current_student)):
    return await service.BrandingAttributesService(db,token).get_brand_attribute(group_id)