<?php

namespace App\Http\Controllers;

use App\Http\Requests\FilterItemsAssociationRequest;
use App\Services\FilterItemsAssociationService;

class FilterItemsAssociationController extends Controller
{

    private $filterItemsAssociationService;

	public function __construct(FilterItemsAssociationService $filterItemsAssociationService)
	{
		$this->filterItemsAssociationService = $filterItemsAssociationService;
	}

    public function index()
    {
        $filterItemsAssociations = $this->filterItemsAssociationService->getAll();

        return response()->json($filterItemsAssociations, 201);
    }

    public function store(FilterItemsAssociationRequest $request)
    {
        $filterItemsAssociations = $this->filterItemsAssociationService->save($request->all());

        return response()->json($filterItemsAssociations, 201);
    }

    public function show($id)
    {
        $filterItemsAssociations = $this->filterItemsAssociationService->get($id);

        return response()->json($filterItemsAssociations);
    }

    public function destroy($id)
    {
      	$this->filterItemsAssociationService->delete($id);
        return response()->json(null, 204);
    }
}