<?php

namespace Database\Seeders;

use App\Models\UnitOfMeasure;
use Illuminate\Database\Seeder;

class UnitOfMeasureSeeder extends Seeder
{
    public function run(): void
    {
        $uoms = [
            ['name' => 'Piece', 'abbreviation' => 'pc'],
            ['name' => 'Kilogram', 'abbreviation' => 'kg'],
            ['name' => 'Gram', 'abbreviation' => 'g'],
            ['name' => 'Liter', 'abbreviation' => 'L'],
            ['name' => 'Milliliter', 'abbreviation' => 'mL'],
            ['name' => 'Meter', 'abbreviation' => 'm'],
            ['name' => 'Centimeter', 'abbreviation' => 'cm'],
            ['name' => 'Pack', 'abbreviation' => 'pack'],
            ['name' => 'Box', 'abbreviation' => 'box'],
            ['name' => 'Carton', 'abbreviation' => 'ctn'],
            ['name' => 'Dozen', 'abbreviation' => 'doz'],
            ['name' => 'Set', 'abbreviation' => 'set'],
            ['name' => 'Pair', 'abbreviation' => 'pair'],
            ['name' => 'Roll', 'abbreviation' => 'roll'],
            ['name' => 'Bundle', 'abbreviation' => 'bdl'],
        ];

        foreach ($uoms as $uom) {
            UnitOfMeasure::firstOrCreate(
                ['name' => $uom['name']],
                $uom
            );
        }
    }
}
