<?php

use App\Models\Companies\CompanyMemberRank;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCompanyMembersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('company_members', function (Blueprint $table) {
            $table->id();
			$table->char('uuid', 36)->index()->unique();
            $table->integer('user_id')->index()->nullable();
            $table->integer('company_id')->index()->nullable();
            $table->integer('department_id')->index()->nullable();
            $table->smallInteger('rank')->index()->default(CompanyMemberRank::EMPLOYEE);
            $table->string('role')->index()->nullable();
            $table->string('position')->index()->nullable();
            $table->string('room')->index()->nullable();
            $table->string('intercom')->index()->nullable();
            $table->boolean('selected')->index()->default(0);
            $table->timestamps();
			$table->softDeletes();
        });
    }

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