<?php

namespace App\Repositories\Eloquent;

use App\Models\InnerOptionSet;
use Illuminate\Database\Eloquent\Model;

class InnerOptionSetRepository extends BaseRepository
{
    protected function resolveModel(): Model
    {
        return new InnerOptionSet();
    }

    public function all(array $columns = ['*']): \Illuminate\Database\Eloquent\Collection
    {
        return $this->model->with('items')->get($columns);
    }

    public function getActive()
    {
        return $this->model->active()->with('items')->get();
    }

    public function getByType(string $type)
    {
        return $this->model->byType($type)->active()->with('items')->get();
    }

    public function getWithActiveItems(int $id): ?InnerOptionSet
    {
        return $this->model->with('activeItems')->find($id);
    }
}
