<?php
// app/controllers/BaseController.php

declare(strict_types=1);

use ScMedia\Http\Response;

abstract class BaseController {
  protected Container $container;

  public function __construct(Container $container) {
    $this->container = $container;
  }

  protected function services(): array {
    return $this->container->all();
  }

  protected function db() {
    return $this->container->db();
  }

  protected function settings() {
    return $this->container->settings();
  }

  protected function auth() {
    return $this->container->auth();
  }

  protected function logger() {
    return $this->container->logger();
  }

  protected function config(): array {
    return $this->container->config();
  }

  protected function json($payload, int $status = 200): void {
    Response::json($payload, $status);
  }
}
