<?php
declare(strict_types=1);

use Migrations\AbstractMigration;

class CreateContactUsFormSubmissions extends AbstractMigration
{
    /**
     * Change Method.
     *
     * More information on this method is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     * @return void
     */
    public function change(): void
    {
        $table = $this->table('contact_us_form_submissions', ['id' => false, 'primary_key' => ['id']]);

        $table->addColumn('id', 'uuid', [
            'default' => null,
            'null' => false,
        ]);
        $table->addColumn('submitted_at', 'datetime', [
            'default' => null,
            'null' => false,
        ]);
        $table->addColumn('client_ip', 'string', [
            'default' => null,
            'limit' => 45,
            'null' => false,
        ]);
        $table->addColumn('name', 'string', [
            'default' => null,
            'limit' => 255,
            'null' => false,
        ]);
        $table->addColumn('email', 'string', [
            'default' => null,
            'limit' => 255,
            'null' => true,
        ]);
        $table->addColumn('subject', 'string', [
            'default' => null,
            'limit' => 255,
            'null' => true,
        ]);
        $table->addColumn('message', 'text', [
            'default' => null,
            'null' => false,
        ]);
        $table->addColumn('confirm_email_sent', 'datetime', [
            'default' => null,
            'null' => true,
        ]);
        $table->addColumn('backend_email_sent', 'datetime', [
            'default' => null,
            'null' => true,
        ]);
        $table->create();
    }
}