<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('companies', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->binary('company_logo')->nullable();
            $table->string('name', 100);
            $table->enum('type', ['guest', 'affiliated', 'pending'])->default('guest');
            $table->string('email_address', 100);
 	        $table->double('service_charge', 10, 2)->comment = 'Company Service Charge';
            $table->enum('is_iec_member', ['true', 'false']);
            $table->enum('is_banned', ['true', 'false']);
            $table->enum('enable_borrowing', ['true', 'false'])->default('true')->comment = 'If enabled, all of the function related to borrowing will be hidden';
            $table->float('discount')->nullable()->comment = 'Company Subscription Discount';
            $table->string('company_tel', 50)->nullable();
            $table->string('company_tel2', 50)->nullable();
            $table->string('street_address', 50)->nullable();
            $table->string('city', 50)->nullable();
            $table->string('state', 50)->nullable();
            $table->string('zipcode', 5)->nullable();
            $table->string('contact_person_name', 100)->nullable();
            $table->string('contact_person_no', 50)->nullable();
            $table->date('date_email_verified')->nullable();
            $table->decimal('overhead_charge', 10, 2)->default(0);
            $table->enum('overhead_type', ['real', 'percent'])->default('percent');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('companies');
    }
};
