<?php

namespace Database\Seeders;

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

class UomSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $uoms = [
            ['code' => 'PCS', 'name' => 'Pieces', 'factor_to_base' => 1.000000],
            ['code' => 'KG', 'name' => 'Kilograms', 'factor_to_base' => 1.000000],
            ['code' => 'G', 'name' => 'Grams', 'factor_to_base' => 0.001000],
            ['code' => 'TON', 'name' => 'Tons', 'factor_to_base' => 1000.000000],
            ['code' => 'M', 'name' => 'Meters', 'factor_to_base' => 1.000000],
            ['code' => 'CM', 'name' => 'Centimeters', 'factor_to_base' => 0.010000],
            ['code' => 'MM', 'name' => 'Millimeters', 'factor_to_base' => 0.001000],
            ['code' => 'KM', 'name' => 'Kilometers', 'factor_to_base' => 1000.000000],
            ['code' => 'L', 'name' => 'Liters', 'factor_to_base' => 1.000000],
            ['code' => 'ML', 'name' => 'Milliliters', 'factor_to_base' => 0.001000],
            ['code' => 'BOX', 'name' => 'Boxes', 'factor_to_base' => 1.000000],
            ['code' => 'CARTON', 'name' => 'Cartons', 'factor_to_base' => 1.000000],
            ['code' => 'PACK', 'name' => 'Packs', 'factor_to_base' => 1.000000],
            ['code' => 'ROLL', 'name' => 'Rolls', 'factor_to_base' => 1.000000],
            ['code' => 'SET', 'name' => 'Sets', 'factor_to_base' => 1.000000],
            ['code' => 'PAIR', 'name' => 'Pairs', 'factor_to_base' => 1.000000],
            ['code' => 'DOZEN', 'name' => 'Dozens', 'factor_to_base' => 12.000000],
            ['code' => 'GROSS', 'name' => 'Gross', 'factor_to_base' => 144.000000],
            ['code' => 'SQM', 'name' => 'Square Meters', 'factor_to_base' => 1.000000],
            ['code' => 'CBM', 'name' => 'Cubic Meters', 'factor_to_base' => 1.000000],
        ];

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