<?php

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

class CreateConversasTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('conversas', function (Blueprint $table) {
            $table->id();
            $table->enum('estado',['aberta','processo','fechada'])->default('aberta');
            $table->enum('originatario',['funcionario','cliente'])->default('funcionario');
            $table->enum('prioridade',['urgente','necessario','importante'])->default('necessario');
            $table->enum('tipopedido',['fisico','virtual','normal'])->default('normal');
            $table->string('tema');
            //adiconal--Stress
            $table->enum('conversatipo',['privada','grupo','secreta','comun'])->default('privada');
            $table->foreignId('user_id');
            $table->foreign('user_id')->references('id')->on('users');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
         Schema::table('conversas', function(Blueprint $table)
        {
            $table->dropSoftDeletes();
        });
        Schema::dropIfExists('conversas');
    }
}
