<?php
// app/Container.php

declare(strict_types=1);

final class Container {
  private array $services;

  public function __construct(array $services) {
    $this->services = $services;
  }

  public function get(string $key) {
    return $this->services[$key] ?? null;
  }

  public function set(string $key, $value): void {
    $this->services[$key] = $value;
  }

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

  public function db() {
    return $this->get('db');
  }

  public function settings() {
    return $this->get('settings');
  }

  public function auth() {
    return $this->get('auth');
  }

  public function logger() {
    return $this->get('logger');
  }

  public function config(): array {
    return (array)($this->get('config') ?? []);
  }
}
