<?php

namespace CliqThemes\ORM\Form\Storage;

use CliqThemes\ORM\Form\StorageStrategy;
use CliqThemes\ORM\Model;

class PassthroughStrategy implements StorageStrategy
{
    public function __construct(private Model $model)
    {
    }

    public function saveOrUpdate(int $modelId, string $field, mixed $value): void
    {
        $this->model->setAttribute($field, $value);
    }

    public function get(int $modelId, string $field): mixed
    {
        return $this->model->getAttribute($field);
    }

    public function delete(int $modelId, string $field): void
    {
        $this->model->setAttribute($field, null);
    }
}
