<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddBusinessFieldsToContactsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('contacts', function (Blueprint $table) {
            $table->enum('business_type', [
                'pt',
                'cv',
                'yayasan',
                'koperasi',
                'perorangan',
                'firma',
                'bumdes',
                'instansi_pemerintah',
                'bumn_bumd',
            ])->default('perorangan');
            $table->string('institutional_name')->nullable();
            $table->unsignedInteger('dependents_count')->nullable();
            $table->string('country')->default('ID');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('contacts', function (Blueprint $table) {
            $table->dropColumn([
                'business_type',
                'institutional_name',
                'dependents_count',
                'country',
            ]);
        });
    }
}
