# coding: utf-8

from typing import Dict, List  # noqa: F401

from fastapi import (  # noqa: F401
    APIRouter,
    Body,
    Cookie,
    Depends,
    Form,
    Header,
    Path,
    Query,
    Response,
    Security,
    status,
)

from ecp4_api_fast.models.extra_models import TokenModel  # noqa: F401
from ecp4_api_fast.models.api_response import ApiResponse
from ecp4_api_fast.models.plug import Plug
from ecp4_api_fast.models.plug_list import PlugList
from ecp4_api_fast.models.plug_update import PlugUpdate


router = APIRouter(prefix="/v1")


@router.get(
    "/plugs",
    responses={
        200: {"model": PlugList, "description": "Dict with plugs"},
    },
    tags=["plugs"],
    summary="List all plugs",
    response_model_by_alias=True,
)
async def plugs_get(
) -> PlugList:
    """Returns a list of all configured plugs"""
    ...


@router.post(
    "/plugs/{id}/actions/recover",
    responses={
        200: {"model": ApiResponse, "description": "Successful operation"},
        409: {"model": ApiResponse, "description": "Conflicts with current resource state"},
        404: {"model": ApiResponse, "description": "Resource was not found"},
        500: {"model": ApiResponse, "description": "Unexpected server error"},
    },
    tags=["plugs"],
    summary="Recover soft error",
    response_model_by_alias=True,
)
async def plugs_id_actions_recover_post(
    id: int
 = Path(..., description="Numeric index of the plug (e.g., 0 for Plug0, 1 for Plug1)")
,
) -> ApiResponse:
    ...


@router.post(
    "/plugs/{id}/actions/start",
    responses={
        200: {"model": ApiResponse, "description": "Successful operation"},
        409: {"model": ApiResponse, "description": "Conflicts with current resource state"},
        404: {"model": ApiResponse, "description": "Resource was not found"},
        500: {"model": ApiResponse, "description": "Unexpected server error"},
    },
    tags=["plugs"],
    summary="Start charging session",
    response_model_by_alias=True,
)
async def plugs_id_actions_start_post(
    id: int
 = Path(..., description="Numeric index of the plug (e.g., 0 for Plug0, 1 for Plug1)")
,
) -> ApiResponse:
    ...


@router.post(
    "/plugs/{id}/actions/stop",
    responses={
        200: {"model": ApiResponse, "description": "Successful operation"},
        409: {"model": ApiResponse, "description": "Conflicts with current resource state"},
        404: {"model": ApiResponse, "description": "Resource was not found"},
        500: {"model": ApiResponse, "description": "Unexpected server error"},
    },
    tags=["plugs"],
    summary="Stop charging session",
    response_model_by_alias=True,
)
async def plugs_id_actions_stop_post(
    id: int
 = Path(..., description="Numeric index of the plug (e.g., 0 for Plug0, 1 for Plug1)")
,
) -> ApiResponse:
    ...


@router.patch(
    "/plugs/{id}",
    responses={
        200: {"model": Plug, "description": "Updated plug object"},
        404: {"model": ApiResponse, "description": "Resource was not found"},
        409: {"model": ApiResponse, "description": "Conflicts with current resource state"},
        422: {"model": ApiResponse, "description": "Request is syntactically valid but contains semantically invalid data"},
        500: {"model": ApiResponse, "description": "Unexpected server error"},
    },
    tags=["plugs"],
    summary="Partially update plug properties",
    response_model_by_alias=True,
)
async def plugs_id_patch(
    id: int
 = Path(..., description="Numeric index of the plug (e.g., 0 for Plug0, 1 for Plug1)")
,
    plug_update: PlugUpdate
 = Body(..., description="")
,
) -> Plug:
    """Updates one or more mutable fields of a plug"""
    ...
