<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('checkout_sessions', function (Blueprint $table) {
            $table->timestamp('accepted_terms_at')->nullable()->after('coupon_snapshot');
            $table->timestamp('accepted_privacy_at')->nullable()->after('accepted_terms_at');
            $table->timestamp('accepted_withdrawal_notice_at')->nullable()->after('accepted_privacy_at');
            $table->timestamp('digital_content_waiver_at')->nullable()->after('accepted_withdrawal_notice_at');
            $table->string('legal_version', 50)->nullable()->after('digital_content_waiver_at');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('checkout_sessions', function (Blueprint $table) {
            $table->dropColumn([
                'accepted_terms_at',
                'accepted_privacy_at',
                'accepted_withdrawal_notice_at',
                'digital_content_waiver_at',
                'legal_version',
            ]);
        });
    }
};
