<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

/**
 * Photo requirement per task — orthogonal to input_type. Any task type can
 * ask the tech for a photo alongside the main input:
 *   'n_a'      → no photo prompt (default)
 *   'optional' → tech may attach a photo but isn't required to
 *   'required' → tech must attach a photo to close the task
 *
 * Denormalised onto work_order_tasks so generated WOs carry the setting.
 */
final class TaskPhotoRequirement extends AbstractMigration
{
    public function change(): void
    {
        $this->table('pm_template_tasks')
            ->addColumn('photo_requirement', 'string', [
                'limit'   => 20,
                'default' => 'n_a',
                'after'   => 'is_required',
            ])
            ->update();

        $this->table('work_order_tasks')
            ->addColumn('photo_requirement', 'string', [
                'limit'   => 20,
                'default' => 'n_a',
                'after'   => 'is_required',
            ])
            ->update();
    }
}
