<?php

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

class CreateClcSoapOptionsTable extends Migration
{
    public function up()
    {
        if (!Schema::hasTable('clc_soap_options')) {
            Schema::create('clc_soap_options', function (Blueprint $table) {
                $table->increments('id');
                $table->unsignedInteger('business_id')->nullable()->index(); // null = system default
                $table->enum('section', ['complaint', 'lab_test', 'exam_test', 'frequency', 'body_system']);
                $table->string('species', 20)->default('all'); // all | dog | cat | rabbit | bird
                $table->string('label', 120);
                $table->unsignedSmallInteger('sort_order')->default(0);
                $table->enum('status', ['active', 'inactive'])->default('active');
                $table->timestamps();
            });
        }
    }

    public function down()
    {
        Schema::dropIfExists('clc_soap_options');
    }
}
