<?php

namespace App\Processor;

use App\Services\MyLogService;
use CodeIgniter\Database\BaseConnection;

abstract class CommonProcessor
{
  final protected $db = null;
  final protected ?MyLogService $logService = null;
  protected function __construct(BaseConnection $db)
  {
    $this->db         = $db;
    $this->logService = new MyLogService();
  }

  final protected function setLog(string $title, string $status, ?string $context = null): void
  {
    $this->logService->create([
      'title'  => $title,
      'status' => $status,
      'context' => $context
    ]);
  }
}
