<?php

declare(strict_types=1);

namespace Apexl\Vault\Schemas;

use Apexl\Vault\Exceptions\MongoUnsupportedException;
use Apexl\Vault\Interfaces\SchemaInterface;
use stdClass;

final class MongoSchema implements SchemaInterface
{
    /**
     * Mongo collections are schemaless, so there is no static column list to return.
     * Answering with an empty list says "I know nothing about this collection's
     * columns", which is what callers such as entityDatabaseOperator::getTableColumns
     * can work with; throwing here broke them. Mongo-aware operators infer shape by
     * sampling instead.
     */
    public function describe(string $table): array
    {
        return [];
    }

    public function createTable(string $table, stdClass $colList, bool $existsCheck = true): void
    {
        throw new MongoUnsupportedException(
            'createTable() is SQL-DDL; use MongoMigrationHelper::ensureIndex from a Phinx migration'
        );
    }

    /**
     * Mongo has no SQL-style auto-increment: the counters strategy issues int ids
     * explicitly rather than reading them back from collection metadata.
     */
    public function keyIsAutoIncrementing(string $keyField, string $table): bool
    {
        return false;
    }
}
