<?php

declare(strict_types=1);

namespace Instinctor\Core\DB;

if ( ! defined( 'ABSPATH' ) ) exit;

/**
 * DriverInterface — contract every DB driver must satisfy.
 *
 * Method signatures intentionally mirror $wpdb so call-site migration
 * is a mechanical find-and-replace with no logic changes.
 */
interface DriverInterface
{
    public function prepare(string $query, mixed ...$args): string;

    /** @return array<object|array> */
    public function get_results(string $query, string $output = 'OBJECT'): array;

    public function get_row(string $query, string $output = 'OBJECT', int $y = 0): mixed;

    public function get_var(string $query, int $x = 0, int $y = 0): ?string;

    /** @return array<string> */
    public function get_col(string $query, int $x = 0): array;

    public function query(string $query): int|false;

    public function insert(string $table, array $data, ?array $format = null): int|false;

    public function update(
        string $table,
        array $data,
        array $where,
        ?array $format = null,
        ?array $where_format = null
    ): int|false;

    public function delete(string $table, array $where, ?array $where_format = null): int|false;

    public function replace(string $table, array $data, ?array $format = null): int|false;

    public function prefix(): string;

    public function insert_id(): int;

    public function last_error(): string;

    public function esc_like(string $text): string;

    public function get_charset_collate(): string;

    public function table(string $name): string;
}
