<?php

namespace Database\Seeders;

use App\Enums\PropertyType;
use App\Models\Parking;
use App\Models\Property;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class ParkSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $departments = [
            // Tipo A (62.38 m²)
            ['title' => 'PARQUEO 1', 'code' => 'P-1', 'surface' => 15.86, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],
            ['title' => 'PARQUEO 2', 'code' => 'P-2', 'surface' => 13.80, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],
            ['title' => 'PARQUEO 3', 'code' => 'P-3', 'surface' => 13.80, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],
            ['title' => 'PARQUEO 4', 'code' => 'P-4', 'surface' => 14.43, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],
            ['title' => 'PARQUEO 5', 'code' => 'P-5', 'surface' => 15.47, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],
            ['title' => 'PARQUEO 6', 'code' => 'P-6', 'surface' => 15.47, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],
            ['title' => 'PARQUEO 7', 'code' => 'P-7', 'surface' => 14.43, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],
            ['title' => 'PARQUEO 8', 'code' => 'P-8', 'surface' => 14.41, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],
            ['title' => 'PARQUEO 9', 'code' => 'P-9', 'surface' => 14.41, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],
            ['title' => 'PARQUEO 10', 'code' => 'P-10', 'surface' => 15.01, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],
            ['title' => 'PARQUEO 11', 'code' => 'P-11', 'surface' => 15.01, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],
            ['title' => 'PARQUEO 12', 'code' => 'P-12', 'surface' => 15.85, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],
            ['title' => 'PARQUEO 13', 'code' => 'P-13', 'surface' => 16.18, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],
            ['title' => 'PARQUEO 14', 'code' => 'P-14', 'surface' => 14.95, 'base_price' => 13500, 'floor' => 'SUB SUELO', 'covered' => true],

            ['title' => 'PARQUEO 15', 'code' => 'P-15', 'surface' => 12.76, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => false],
            ['title' => 'PARQUEO 16', 'code' => 'P-16', 'surface' => 12.76, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => false],
            ['title' => 'PARQUEO 17', 'code' => 'P-17', 'surface' => 15.84, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => true],
            ['title' => 'PARQUEO 18', 'code' => 'P-18', 'surface' => 15.71, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => true],
            ['title' => 'PARQUEO 19', 'code' => 'P-19', 'surface' => 17.98, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => true],
            ['title' => 'PARQUEO 20', 'code' => 'P-20', 'surface' => 17.10, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => true],
            ['title' => 'PARQUEO 21', 'code' => 'P-21', 'surface' => 16.94, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => true],
            ['title' => 'PARQUEO 22', 'code' => 'P-22', 'surface' => 16.79, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => true],
            ['title' => 'PARQUEO 23', 'code' => 'P-23', 'surface' => 21.67, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => false],
            ['title' => 'PARQUEO 24', 'code' => 'P-24', 'surface' => 26.43, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => false],
            ['title' => 'PARQUEO 25', 'code' => 'P-25', 'surface' => 19.96, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => true],
            ['title' => 'PARQUEO 26', 'code' => 'P-26', 'surface' => 19.92, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => true],
            ['title' => 'PARQUEO 27', 'code' => 'P-27', 'surface' => 19.88, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => true],
            ['title' => 'PARQUEO 28', 'code' => 'P-28', 'surface' => 28.95, 'base_price' => 13500, 'floor' => 'PLANTA BAJA', 'covered' => true],
         ];

        foreach ($departments as $deptData) {
            $property = Property::create([
                'title' => $deptData['title'],
                'code' => $deptData['code'],
                'surface' => $deptData['surface'],
                'base_price' => $deptData['base_price'],
                'percentage_initial_fee' => 20.00,
                'initial_fee' => $deptData['base_price']* 0.20,
                'precio_por_m2' => $deptData['precio_por_m2'] ?? null,
                'property_type_id' => 2,
                'project_id' => 1,
                'property_type' => PropertyType::PARK->name
            ]);

            Parking::create([
                'property_id' => $property->id,
                'floor' => $deptData['floor'],
                'covered' => $deptData['covered'],
            ]);

        }
    }
}
