<?php

namespace App\OldDataMigrations;

class RawMaterialsMigration extends BaseOldDataMigration
{
    public function priority(): int
    {
        return 4;
    }

    public function migrate(): array
    {
        $results = [];

        $results['raw_materials'] = $this->migrateTable('raw_materials', function ($row) {
            $row['unit'] = match ($row['unit']) {
                'kilogram' => 'kg',
                default => $row['unit'],
            };

            return $row;
        });
        $results['raw_material_prices'] = $this->migrateTable('raw_material_prices');

        return $results;
    }
}
