<?php

namespace UltraguardPro\modules\authenticator\schema;

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

use UltraguardPro\modules\core\AbstractModuleSchema;

class AuthenticatorSchema extends AbstractModuleSchema {

    public function get_module_id(): string {
        return 'authenticator';
    }

    public function get_table_map(): array {
        return [
            'totp_credentials'   => \UltraguardPro\modules\authenticator\db\TotpCredentialsTable::class,
            'passkeys'           => \UltraguardPro\modules\authenticator\db\PasskeysTable::class,
            'passkey_challenges' => \UltraguardPro\modules\authenticator\db\PasskeyChallengesTable::class,
            'recovery_codes'     => \UltraguardPro\modules\authenticator\db\RecoveryCodesTable::class,
        ];
    }

    public function get_schemas(): array {
        $schemas = [];

        $two_factor = new TwoFactorSchema();
        foreach ( $two_factor->get_schemas() as $table => $sql ) {
            $schemas[ $table ] = $sql;
        }

        $passkeys = new PasskeysSchema();
        foreach ( $passkeys->get_schemas() as $table => $sql ) {
            $schemas[ $table ] = $sql;
        }

        return $schemas;
    }
}
