<?php

namespace App\Http\Controllers\Admin\Admin;

use App\Models\Admin;
use App\Models\Fail;
use App\Models\Success;
use App\Models\Rating;
use App\Providers\AdminProvider;

class AdminDeleteController
{
    public function __construct(public AdminProvider $adminProvider)
    {
    }
    public function index($IdAdmin)
    {
        $admin = $this->adminProvider->findAdmin($IdAdmin);
        if($admin== null){
            return $this->adminProvider->findAdminFail();
        }
        $admin->delete();
        return json_encode(new Success(
            true,
            "Deleted",
            (object)[
            ]
            )
        );
    }

}
