<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        if(!Schema::hasTable('ore_composition')) {
            Schema::create('ore_composition', function(Blueprint $table) {
                $table->id();
                $table->string('Name')->nullable();
                $table->unsignedBigInteger('ItemId')->unique();
                $table->decimal('m3Size', 20, 2)->default(0.00);
                $table->integer('BatchSize')->default(100);
                $table->unsignedInteger('Tritanium')->default(0);
                $table->unsignedInteger('Pyerite')->default(0);
                $table->unsignedInteger('Mexallon')->default(0);
                $table->unsignedInteger('Isogen')->default(0);
                $table->unsignedInteger('Nocxium')->default(0);
                $table->unsignedInteger('Zydrine')->default(0);
                $table->unsignedInteger('Megacyte')->default(0);
                $table->unsignedInteger('Morphite')->default(0);
                $table->unsignedInteger('Heavy_Water')->default(0);
                $table->unsignedInteger('Liquid_Ozone')->default(0);
                $table->unsignedInteger('Nitrogen_Isotopes')->default(0);
                $table->unsignedInteger('Helium_Isotopes')->default(0);
                $table->unsignedInteger('Hydrogen_Isotopes')->default(0);
                $table->unsignedInteger('Oxygen_Isotopes')->default(0);
                $table->unsignedInteger('Strontium_Clathrates')->default(0);
                $table->unsignedInteger('Atmosperhic_Gases')->default(0);
                $table->unsignedInteger('Evaporite_Deposits')->default(0);
                $table->unsignedInteger('Hydrocarbons')->default(0);
                $table->unsignedInteger('Silicates')->default(0);
                $table->unsignedInteger('Cobalt')->default(0);
                $table->unsignedInteger('Scandium')->default(0);
                $table->unsignedInteger('Titanium')->default(0);
                $table->unsignedInteger('Tungsten')->default(0);
                $table->unsignedInteger('Cadmium')->default(0);
                $table->unsignedInteger('Platinum')->default(0);
                $table->unsignedInteger('Vanadium')->default(0);
                $table->unsignedInteger('Chromium')->default(0);
                $table->unsignedInteger('Technetium')->default(0);
                $table->unsignedInteger('Hafnium')->default(0);
                $table->unsignedInteger('Caesium')->default(0);
                $table->unsignedInteger('Mercury')->default(0);
                $table->unsignedInteger('Dysprosium')->default(0);
                $table->unsignedInteger('Neodymium')->default(0);
                $table->unsignedInteger('Promethium')->default(0);
                $table->unsignedInteger('Thulium')->default(0);
            });
        }

        if(!Schema::hasTable('mineral_prices')) {
            Schema::create('mineral_prices', function(Blueprint $table) {
                $table->id();
                $table->unsignedBigInteger('ItemId');
                $table->string('Name');
                $table->decimal('Price', 20, 2);
                $table->dateTime('Time');
            });
        }

        if(!Schema::hasTable('ore_prices')) {
            Schema::create('ore_prices', function(Blueprint $table) {
                $table->id();
                $table->unsignedBigInteger('ItemId');
                $table->string('Name');
                $table->decimal('BatchPrice', 20, 2);
                $table->decimal('UnitPrice', 20, 2);
                $table->decimal('m3Price', 20, 2);
                $table->dateTime('Time');
            });
        }
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('ore_composition');
        Schema::dropIfExists('mineral_prices');
        Schema::dropIfExists('ore_prices');
    }
};
