<?php

namespace App\Http\Controllers\API;

use App\Http\Controllers\Controller;
use App\Http\Resources\PageResource;
use App\Http\Resources\PowerResource;
use App\Http\Resources\RegionWithCityResource;
use App\Models\Page;
use App\Models\Power;
use App\Models\Region;

class PageController extends Controller
{
    public function policy()
    {
        $policy = Page::where('slug', 'policy')->first();

        return new PageResource($policy);
    }

    public function about()
    {
        $about = Page::where('slug', 'about')->first();

        return new PageResource($about);
    }

    public function powers()
    {
        $powers = Power::all();

        return PowerResource::collection($powers);
    }

    public function regions()
    {
        $regions = Region::all();

        return RegionWithCityResource::collection($regions);
    }
}
