<?php

namespace App\Console\Commands;

use App\Person;
use App\Tools\TMNTools;
use Carbon\Carbon;
use Illuminate\Console\Command;

class PeopleFaker extends Command
{
    private $tool;
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'people:faker';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
        $this->tool = new TMNTools();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->line('*****************************');
        $this->warn('CREATING PEOPLE...PLEASE WAIT');
        $this->line('*****************************');

        // create people
        foreach ($this->people() as &$person)
        {
            $person['full_name'] = $person['first_name'] ." ". $person['last_name'];
            $item  = new Person($person);
            $item->save();
        }

        $this->line('*****************************');
        $this->warn('PROCESS COMPLETED ...EXITING!');
        $this->line('*****************************');
    }

    // data
    private function people()
    {
        $people = [
            [
                'first_name'    => 'Damian',
                'last_name'     => 'Amegashie',
                'email'         => 'adamian@npontu.com',
                'phone_number'  => '0248825623',
                'meta'          => [
                    'gender'    => 'male',
                    'birth_year'=> 1999,
                    'country'   => 'ghana',
                    'region'    => 'volta',
                    'city'      => 'keta',
                    'language'  => 'english',
                    'computers' => ['computer servers', 'software', 'hard drives', 'network storage', 'tablet computers']
                ]
            ],
            [
                'first_name'    => 'Alphonse',
                'last_name'     => 'Malan',
                'email'         => 'aamalan@npontu.com',
                'phone_number'  => '0248524039',
                'meta'          => [
                    'gender'    => 'male',
                    'birth_year'=> 1999,
                    'country'   => 'ghana',
                    'region'    => 'greater accra',
                    'city'      => 'malam',
                    'language'  => 'french',
                    'consumer_electronics' => ['game consoles', 'smartphones', 'gps devices', 'audio equipment']
                ]
            ],
            [
                'first_name'    => 'Adjoa',
                'last_name'     => 'Arthur',
                'email'         => 'ajarthur@npontu.com',
                'phone_number'  => '0548971020',
                'meta'          => [
                    'gender'    => 'female',
                    'birth_year'=> 1995,
                    'country'   => 'ghana',
                    'region'    => 'central',
                    'city'      => 'anomabo',
                    'language'  => 'spanish',
                    'foods'     => ['barbecue', 'chocolate', 'fast food', 'pizza', 'desserts']
                ]
            ],
            [
                'first_name'    => 'Debraw',
                'last_name'     => 'Marfo',
                'email'         => 'smarfo@gmail.com',
                'phone_number'  => '0572199011',
                'meta'          => [
                    'gender'    => 'male',
                    'birth_year'=> 1999,
                    'country'   => 'ghana',
                    'region'    => 'ashanti',
                    'city'      => 'kumasi',
                    'language'  => 'hindi',
                    'restaurants' => ['chop bars', 'coffee houses', 'diners', 'fast food restaurants']
                ]
            ],
            [
                'first_name'    => 'Delali',
                'last_name'     => 'Ametepey',
                'email'         => 'pdametepey@npontu.com',
                'phone_number'  => '0244988861',
                'meta'          => [
                    'gender'    => 'female',
                    'birth_year'=> 1995,
                    'country'   => 'ghana',
                    'region'    => 'greater accra',
                    'city'      => 'dansoman',
                    'language'  => 'english',
                    'tv_shows'  => ['tv comedies', 'tv reality shows', 'tv talk shows', 'telenovelas']
                ]
            ]
        ];
        return $people;
    }
}
