<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('aziendas', function (Blueprint $table) {
            $table->id();

            // General information
            $table->string('ragione_sociale');
            $table->string('nome_associazione')->nullable();
            $table->string('tipologia')->nullable();
            $table->string('logo')->nullable();

            // Legal address
            $table->string('sede_legale_nazione')->nullable();
            $table->string('sede_legale_provincia')->nullable();
            $table->string('sede_legale_comune')->nullable();
            $table->string('sede_legale_indirizzo')->nullable();
            $table->string('sede_legale_cap')->nullable();

            // Operational address
            $table->string('sede_operativa_nazione')->nullable();
            $table->string('sede_operativa_provincia')->nullable();
            $table->string('sede_operativa_comune')->nullable();
            $table->string('sede_operativa_indirizzo')->nullable();
            $table->string('sede_operativa_cap')->nullable();

            // Contacts
            $table->string('email');
            $table->string('pec');
            $table->string('telefono')->nullable();
            $table->string('cellulare');

            // Fiscal data
            $table->string('partita_iva')->nullable();
            $table->string('codice_fiscale')->nullable();
            $table->string('codice_sdi')->nullable();

            // Accounting configuration
            $table->date('chiusura_anno_fiscale')->nullable();
            $table->date('scadenza_abbonamenti')->nullable();
            $table->date('scadenza_pagamenti_uscita')->nullable();

            $table->timestamps();
        });
    }

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