<?php

namespace Database\Seeders;

use App\Models\EtapeProjet;
use App\Models\ProjetStatut;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use TYPE_CALCUL_GAINS;

class ProjetSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        if (app()->environment('local'))
        {
            DB::table('projets')->insert([
                "reference" => "F-1-11-2020",
                "finess" => null,
                "description" => "Descriptif 1",
                "objet" => "Objet 1",
                "date_debut" => "2020-11-01",
                "date_fin" => "2020-11-30",
                "date_mise_en_oeuvre" => null,
                "code_nomenclature" => null,
                "budget" => "investissement",
                "libelle_marche_a_renouveler" => "Libellé 1",
                "numero_marche_a_renouveler" => "Numéro marché 1",
                "renouvellement_marche" => true,
                "libelle_nouveau_marche" => "Libellé 1 nouveau marché",
                "numero_nouveau_marche" => "Numéro marché 1 nouveau marché",
                "programmation" => 1,
                "ondam" => 1,
                "montant_reference" => null,
                "montant_realise" => null,
                "type_calcul_gains" => TYPE_CALCUL_GAINS::ACHATS_COMPLEXES,
                "impact_budgetaire" => "1.00",
                "gains_cible" => null,
                "gains_securise" => null,
                "gains_notifie" => null,
                //"type_achat_investissement" => null,
                "duree_mois" => null,
                "commentaire" => null,
                "programme" => 0,
                "soumis" => 0,
                "prochaine_echeance" => null,
                "prochaine_etape" => null,
                "etat_avancement" => null,
                "cloture" => 0,
                "valide_controleur_gestion" => 0,
                "risque" => "maitrise",
                "paat_id" => 1,
                "owner_id" => 1,
                "structure_id" => 2,
                "direction_id" => 1,
                "service_id" => 1,
                "niveau_mutualisation_id" => 1,
                "operateur_mutualisation_id" => 1,
                "imputation_budgetaire_id" => 1,
                "famille_id" => null,
                "domaine_id" => null,
                "categorie_id" => null,
                "segment_id" => null,
                "created_at" => date("Y-m-d H:i:s"),
                "updated_at" => date("Y-m-d H:i:s")
            ]);

            EtapeProjet::insert(['etape' => 'creation', 'projet_id' => 1]);
            ProjetStatut::insert(['user_id' => 1, 'projet_id' => 1, 'statut_id' => 1]); // Ajout du statut en cours
        }
    }
}
