<?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
    {
        Schema::create('contracts', function (Blueprint $table) {
            $table->id();
            $table->string('item_id')->unique();
            $table->string('customer_name');
            $table->integer('customer_id');
            $table->string('minimax_account')->default('insoft');
            $table->boolean('contract_active')->default(true);
            $table->string('contract_no');
            $table->json('contracts_archive')->nullable();
            $table->string('website')->nullable();
            $table->decimal('price_per_month', 10, 2)->default(0);
            $table->decimal('price_per_month_vat', 10, 2)->default(0);
            $table->decimal('price_per_year', 10, 2)->default(0);
            $table->decimal('price_per_year_vat', 10, 2)->default(0);
            $table->string('payment')->default('month');
            $table->integer('invoice_due_days')->default(15);
            $table->date('date_signed')->nullable();
            $table->date('contract_start_date')->nullable();
            $table->date('date_end')->nullable();
            $table->integer('duration')->default(12);
            $table->boolean('auto_renewal')->default(true);
            $table->string('email')->nullable();
            $table->json('primary_email')->nullable();
            $table->json('email_cc')->nullable();
            $table->json('email_bcc')->nullable();
            $table->boolean('eracun')->default(false);
            $table->boolean('send_xml')->default(false);
            $table->boolean('send_invoice_to_email')->default(true);
            $table->text('description_above')->nullable();
            $table->json('napomena')->nullable();
            $table->integer('included_work_hours')->default(0);
            $table->timestamps();
        });
    }

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