<?php
namespace Modules\Employee\Services;

use Modules\Employee\Repositories\EducationLevelRepository;
use Modules\Employee\DTO\EmployeeSettingFilter;
use Illuminate\Support\Facades\DB;
use Modules\Employee\Models\EducationLevel;

class EducationLevelService
{
    protected $educationLevelRepo;

    public function __construct(EducationLevelRepository $educationLevelRepo) {
        $this->educationLevelRepo = $educationLevelRepo;
    }

    public function list(EmployeeSettingFilter $filter)
    {
        return $this->educationLevelRepo->all($filter);
    }

    public function show($id)
    {
        return $this->educationLevelRepo->find($id);
    }

    public function store(array $data)
    {
        return DB::transaction(function () use ($data) {
            return $this->educationLevelRepo->create($data);
        });
    }

    public function update(EducationLevel $educationLevel, array $data)
    {
        return DB::transaction(function () use ($educationLevel, $data) {
            return $this->educationLevelRepo->update($educationLevel, $data);
        });
    }

    public function updateStatus(EducationLevel $educationLevel, array $status)
    {
        return DB::transaction(function () use ($educationLevel, $status) {
            return $this->educationLevelRepo->updateStatus($educationLevel, $status);
        });
    }

}
