<?php

namespace App\Repositories;

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

class ContractSettingRepository extends BaseRepository
{
    public function __construct(ContractSetting $model)
    {
        parent::__construct($model);
    }

    public function create(array $attributes): Model
    {
        return parent::create($attributes);
    }

    public function update(Model $model, array $attributes): bool
    {
        return parent::update($model, $attributes);
    }

    public function getByKey(string $key)
    {
        return $this->model->where('key', $key)->first();
    }

    public function getActiveSettings()
    {
        return $this->model->active()->pluck('content', 'key');
    }
}
