<?php

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

class AddColumnToNewLineRequest extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('new_line_requests', function (Blueprint $table) {
            $table->foreignId('division_id')->nullable();
            $table->foreignId('district_id')->nullable();
            $table->foreignId('upazila_id')->nullable();
            $table->enum('customer_status', ['Survey', 'Marketing', 'Tentative activation date', 'Confirm activation date'])->nullable();
            $table->string('email')->nullable();
            $table->integer('free_days')->nullable();
            $table->enum('multi_router', ['Yes', 'No(1)', 'Access Point'])->nullable();
            $table->text('multi_router_remarks')->nullable();
            $table->integer('divice_uses')->nullable();
            $table->foreignId('source_id')->nullable();
            $table->enum('survey_status', ['Coverage', 'Not Coverage'])->nullable();
            $table->text('survey_remarks')->nullable();
            $table->foreignId('marketing_done')->nullable();
            $table->dateTime('follow_up_date')->nullable();
            $table->integer('tentative_activation_date')->nullable();
            $table->integer('confirm_activation_date')->nullable();
            $table->tinyInteger('support_done')->nullable();

            $table->string('name')->nullable()->change();
            $table->string('address')->nullable()->change();
            $table->foreignId('pop_id')->nullable()->change();
            $table->foreignId('package_id')->nullable()->change();
            $table->integer('otc')->nullable()->change();
            $table->integer('fiver_miter')->nullable()->change();
            $table->string('phone')->nullable()->change();
            $table->integer('created_by')->nullable()->change();
            $table->string('billing_date')->nullable()->change();
            $table->string('status')->nullable()->change();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('new_line_requests', function (Blueprint $table) {
            $table->dropColumn(['division_id', 'district_id', 'upazila_id', 'customer_status', 'email', 'free_days', 'multi_router', 'multi_router_remarks', 'divice_uses', 'source_id', 'survey_status', 'survey_remarks', 'marketing_done', 'follow_up_date', 'tentative_activation_date', 'confirm_activation_date', 'support_done']); 
            $table->string('name')->nullable(false)->change();
            $table->string('address')->nullable(false)->change();
            $table->foreignId('pop_id')->nullable(false)->change();
            $table->foreignId('package_id')->nullable(false)->change();
            $table->integer('otc')->nullable(false)->change();
            $table->integer('fiver_miter')->nullable(false)->change();
            $table->string('phone')->nullable(false)->change();
            $table->integer('created_by')->nullable(false)->change();
            $table->string('billing_date')->nullable(false)->change();
            $table->string('status')->nullable(false)->change();
        });
    }
}
