<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Models\Accommodation;
class AccommodationController extends Controller
{
    public function index()
    {
        $accommodations = DB::table('accommodation')->get();

        return response()->json([
            'status' => 'success',
            'data' => $accommodations
        ]);
    }

        public function show($id)
    {
        $accommodation = Accommodation::find($id);
        
        if (!$accommodation) {
            return response()->json([
                'status' => 'error',
                'message' => 'Accommodation not found'
            ], 404);
        }

        return response()->json([
            'status' => 'success',
            'data' => $accommodation
        ]);
    }
}
