<?php

namespace App\Http\Controllers\Api\Objects;

use App\Http\Controllers\Controller;
use App\Models\Objects\Field;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class FieldsController extends Controller {
    protected Field $model;

    public function __construct(Field $model) {
        $this->model = $model;
    }

    public function index(Request $request): JsonResponse {

        return fractal()->respond();
    }

    public function show(Request $request, $id): JsonResponse {

        return fractal()->respond();
    }

    public function store(Request $request): JsonResponse {

        return fractal()->respond(201);
    }

    public function update(Request $request, $uuid): JsonResponse {

        return fractal()->respond();
    }

    public function destroy(Request $request, $uuid): JsonResponse {
        $model = $this->model->byUuid($uuid)->firstOrFail();
        $model->delete();
        return response()->json(null, 204);
    }
}