<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('meet_recordings', function (Blueprint $table) {
            $table->timestamp('storage_paid_until')->nullable()->after('file_size');
            $table->timestamp('storage_grace_ends_at')->nullable()->after('storage_paid_until');
            $table->timestamp('storage_last_billed_at')->nullable()->after('storage_grace_ends_at');
        });

        Schema::table('meet_session_files', function (Blueprint $table) {
            $table->timestamp('storage_paid_until')->nullable()->after('file_size');
            $table->timestamp('storage_grace_ends_at')->nullable()->after('storage_paid_until');
            $table->timestamp('storage_last_billed_at')->nullable()->after('storage_grace_ends_at');
        });
    }

    public function down(): void
    {
        Schema::table('meet_recordings', function (Blueprint $table) {
            $table->dropColumn(['storage_paid_until', 'storage_grace_ends_at', 'storage_last_billed_at']);
        });

        Schema::table('meet_session_files', function (Blueprint $table) {
            $table->dropColumn(['storage_paid_until', 'storage_grace_ends_at', 'storage_last_billed_at']);
        });
    }
};
