<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\Advertisement;
use App\Models\Customer;
use App\Models\SpatialPlanning;
use Illuminate\Http\Request;

class LackOfPotentialController extends Controller
{

    public function count_lack_of_potential(){
        try{
            $total_reklame = Advertisement::count();
            $total_pdam = Customer::count();
            $total_tata_ruang = SpatialPlanning::count();

            return response()->json([
                'total_reklame' => $total_reklame,
                'total_pdam' => $total_pdam,
                'total_tata_ruang' => $total_tata_ruang
            ], 200);
        }catch(\Exception $e){
            return response()->json([
                'message' => 'Error: '.$e->getMessage()
            ], 500);
        }
    }
}
