# C4rgo Magazzino - Modular configuration
#
# Enable/disable sections (whole CRUD modules) and individual fields per entity.
# The runtime reads this config to:
#   - hide menu entries for disabled sections
#   - hide form fields and table columns for disabled fields
#   - hide tabs/sections of the Articolo edit form
#
# Per-user layout (field order, collapsed state, column widths) is stored in
# the mag_user_layout_pref table and overlays this config.
#
# Reload the cache after changing this file: bin/console cache:clear

parameters:
    c4rgo_magazzino:

        # ---------------------------------------------------------------------
        # SECTIONS: top-level modules of the warehouse system.
        # Set enabled: false to hide the section entirely (menu + routes via voter).
        # ---------------------------------------------------------------------
        sections:
            dashboard:        { enabled: true,  label: 'Dashboard',          icon: 'fa-tachometer-alt', role: ROLE_MAGAZZINO_OPERATOR }
            articoli:         { enabled: true,  label: 'Articoli',           icon: 'fa-cubes',          role: ROLE_MAGAZZINO_OPERATOR }
            categorie:        { enabled: true,  label: 'Categorie',          icon: 'fa-sitemap',        role: ROLE_MAGAZZINO_MANAGER }
            unita_misura:     { enabled: true,  label: 'Unità di Misura',    icon: 'fa-balance-scale',  role: ROLE_MAGAZZINO_MANAGER }
            attributi:        { enabled: false, label: 'Attributi dinamici', icon: 'fa-tags',           role: ROLE_MAGAZZINO_MANAGER }
            magazzini:        { enabled: true,  label: 'Magazzini',          icon: 'fa-warehouse',      role: ROLE_MAGAZZINO_MANAGER }
            ubicazioni:       { enabled: true,  label: 'Ubicazioni',         icon: 'fa-map-marker',     role: ROLE_MAGAZZINO_MANAGER }
            causali:          { enabled: true,  label: 'Causali movimento',  icon: 'fa-tag',            role: ROLE_MAGAZZINO_MANAGER }
            movimenti:        { enabled: true,  label: 'Movimenti',          icon: 'fa-exchange-alt',   role: ROLE_MAGAZZINO_OPERATOR }
            giacenze:         { enabled: true,  label: 'Giacenze',           icon: 'fa-boxes',          role: ROLE_MAGAZZINO_OPERATOR }
            lotti:            { enabled: true,  label: 'Lotti',              icon: 'fa-barcode',        role: ROLE_MAGAZZINO_OPERATOR }
            seriali:          { enabled: true,  label: 'Seriali',            icon: 'fa-fingerprint',    role: ROLE_MAGAZZINO_OPERATOR }
            tracciabilita:    { enabled: true,  label: 'Tracciabilità',      icon: 'fa-route',          role: ROLE_MAGAZZINO_OPERATOR }
            identificatori:   { enabled: false, label: 'Identificatori',     icon: 'fa-qrcode',         role: ROLE_MAGAZZINO_MANAGER }
            import_export:    { enabled: true,  label: 'Import / Export',    icon: 'fa-exchange',       role: ROLE_MAGAZZINO_MANAGER }
            acquisti:         { enabled: false, label: 'Acquisti',           icon: 'fa-shopping-cart',  role: ROLE_MAGAZZINO_MANAGER }
            vendite:          { enabled: false, label: 'Vendite',            icon: 'fa-cash-register',  role: ROLE_MAGAZZINO_MANAGER }
            configurazione:   { enabled: true,  label: 'Configurazione',     icon: 'fa-cog',            role: ROLE_MAGAZZINO_ADMIN }

        # ---------------------------------------------------------------------
        # FIELDS: per-entity enable flag, default order, and section grouping.
        # The drag&drop layout per user only reorders/collapses; it cannot
        # re-enable a field disabled here.
        # ---------------------------------------------------------------------
        entities:

            articolo:
                # Section groupings shown in the edit form (collapsible, draggable)
                form_sections:
                    anagrafica:    { enabled: true,  label: 'Anagrafica',          order: 10, collapsed: false }
                    classificazione: { enabled: true, label: 'Classificazione',    order: 20, collapsed: false }
                    misure:        { enabled: true,  label: 'Misure e UM',         order: 30, collapsed: false }
                    fiscale:       { enabled: false, label: 'Dati fiscali',        order: 40, collapsed: true  }
                    logistica:     { enabled: false, label: 'Logistica',           order: 50, collapsed: true  }
                    acquisti:      { enabled: false, label: 'Acquisti',            order: 60, collapsed: true  }
                    vendite:       { enabled: false, label: 'Vendite',             order: 70, collapsed: true  }
                    media:         { enabled: true,  label: 'Immagini e allegati', order: 80, collapsed: true  }
                    note:          { enabled: true,  label: 'Note',                order: 90, collapsed: true  }

                fields:
                    # Anagrafica
                    codice:                 { enabled: true,  section: anagrafica, order: 10, required: true,  label: 'Codice' }
                    barcode:                { enabled: true,  section: anagrafica, order: 20, required: false, label: 'Barcode/EAN' }
                    descrizione:            { enabled: true,  section: anagrafica, order: 30, required: true,  label: 'Descrizione' }
                    descrizione_estesa:     { enabled: true,  section: anagrafica, order: 40, required: false, label: 'Descrizione estesa' }
                    attivo:                 { enabled: true,  section: anagrafica, order: 50, required: false, label: 'Attivo' }
                    # Classificazione
                    tipo:                   { enabled: true,  section: classificazione, order: 10, required: true,  label: 'Tipo articolo' }
                    categoria:              { enabled: true,  section: classificazione, order: 20, required: false, label: 'Categoria' }
                    marca:                  { enabled: false, section: classificazione, order: 30, required: false, label: 'Marca' }
                    modello:                { enabled: false, section: classificazione, order: 40, required: false, label: 'Modello' }
                    # Misure e UM
                    unita_misura_base:      { enabled: true,  section: misure, order: 10, required: true,  label: 'UM base' }
                    unita_misura_alternative: { enabled: true, section: misure, order: 20, required: false, label: 'UM alternative (confezioni)' }
                    peso_lordo:             { enabled: false, section: misure, order: 30, required: false, label: 'Peso lordo (kg)' }
                    peso_netto:             { enabled: false, section: misure, order: 40, required: false, label: 'Peso netto (kg)' }
                    volume:                 { enabled: false, section: misure, order: 50, required: false, label: 'Volume (m³)' }
                    lunghezza:              { enabled: false, section: misure, order: 60, required: false, label: 'Lunghezza (cm)' }
                    larghezza:              { enabled: false, section: misure, order: 70, required: false, label: 'Larghezza (cm)' }
                    altezza:                { enabled: false, section: misure, order: 80, required: false, label: 'Altezza (cm)' }
                    # Fiscale
                    codice_iva:             { enabled: false, section: fiscale, order: 10, required: false, label: 'Codice IVA' }
                    aliquota_iva:           { enabled: false, section: fiscale, order: 20, required: false, label: 'Aliquota IVA %' }
                    conto_contabile:        { enabled: false, section: fiscale, order: 30, required: false, label: 'Conto contabile' }
                    # Logistica
                    scorta_minima:          { enabled: false, section: logistica, order: 10, required: false, label: 'Scorta minima' }
                    scorta_massima:         { enabled: false, section: logistica, order: 20, required: false, label: 'Scorta massima' }
                    punto_riordino:         { enabled: false, section: logistica, order: 30, required: false, label: 'Punto di riordino' }
                    lotto_riordino:         { enabled: false, section: logistica, order: 40, required: false, label: 'Lotto di riordino' }
                    gestione_lotti:         { enabled: false, section: logistica, order: 50, required: false, label: 'Gestione a lotti' }
                    gestione_seriali:       { enabled: false, section: logistica, order: 60, required: false, label: 'Gestione a seriali' }
                    gestione_scadenze:      { enabled: false, section: logistica, order: 70, required: false, label: 'Gestione scadenze' }
                    strategia_scarico:      { enabled: false, section: logistica, order: 80, required: false, label: 'Strategia scarico lotti' }
                    # Acquisti
                    fornitore_principale:   { enabled: false, section: acquisti, order: 10, required: false, label: 'Fornitore principale' }
                    codice_fornitore:       { enabled: false, section: acquisti, order: 20, required: false, label: 'Codice fornitore' }
                    prezzo_acquisto:        { enabled: false, section: acquisti, order: 30, required: false, label: 'Prezzo acquisto' }
                    valuta_acquisto:        { enabled: false, section: acquisti, order: 40, required: false, label: 'Valuta acquisto' }
                    # Vendite
                    prezzo_vendita:         { enabled: false, section: vendite, order: 10, required: false, label: 'Prezzo vendita' }
                    sconto_max:             { enabled: false, section: vendite, order: 20, required: false, label: 'Sconto massimo %' }
                    listino_default:        { enabled: false, section: vendite, order: 30, required: false, label: 'Listino default' }
                    # Media
                    immagine_principale:    { enabled: true,  section: media, order: 10, required: false, label: 'Immagine principale' }
                    immagini_galleria:      { enabled: true,  section: media, order: 20, required: false, label: 'Galleria immagini' }
                    allegati:               { enabled: true,  section: media, order: 30, required: false, label: 'Allegati' }
                    # Note
                    note_interne:           { enabled: true,  section: note, order: 10, required: false, label: 'Note interne' }
                    note_pubbliche:         { enabled: false, section: note, order: 20, required: false, label: 'Note pubbliche' }

                # Default columns shown in the list view (can be reordered per user)
                list_columns:
                    codice:        { enabled: true,  order: 10, width: 120, label: 'Codice' }
                    descrizione:   { enabled: true,  order: 20, width: 300, label: 'Descrizione' }
                    categoria:     { enabled: true,  order: 30, width: 180, label: 'Categoria' }
                    tipo:          { enabled: true,  order: 40, width: 110, label: 'Tipo' }
                    unita_misura_base: { enabled: true, order: 50, width: 60, label: 'UM' }
                    attivo:        { enabled: true,  order: 60, width: 70,  label: 'Attivo' }
                    creato_il:     { enabled: false, order: 70, width: 130, label: 'Creato il' }

            categoria:
                fields:
                    nome:        { enabled: true,  order: 10, required: true,  label: 'Nome' }
                    codice:      { enabled: true,  order: 20, required: false, label: 'Codice' }
                    descrizione: { enabled: true,  order: 30, required: false, label: 'Descrizione' }
                    icona:       { enabled: false, order: 40, required: false, label: 'Icona' }
                    colore:      { enabled: false, order: 50, required: false, label: 'Colore' }
                    parent:      { enabled: true,  order: 60, required: false, label: 'Categoria padre' }

            unita_misura:
                fields:
                    codice:      { enabled: true,  order: 10, required: true,  label: 'Codice (es. pz, kg, m)' }
                    nome:        { enabled: true,  order: 20, required: true,  label: 'Nome' }
                    descrizione: { enabled: true,  order: 30, required: false, label: 'Descrizione' }
                    tipo:        { enabled: true,  order: 40, required: false, label: 'Tipo (lunghezza, peso, volume, qta...)' }
                    decimali:    { enabled: true,  order: 50, required: false, label: 'Decimali ammessi' }

            magazzino:
                fields:
                    codice:      { enabled: true,  order: 10, required: true,  label: 'Codice' }
                    nome:        { enabled: true,  order: 20, required: true,  label: 'Nome' }
                    descrizione: { enabled: true,  order: 30, required: false, label: 'Descrizione' }
                    indirizzo:   { enabled: true,  order: 40, required: false, label: 'Indirizzo' }
                    citta:       { enabled: true,  order: 50, required: false, label: 'Città' }
                    cap:         { enabled: false, order: 60, required: false, label: 'CAP' }
                    nazione:     { enabled: false, order: 70, required: false, label: 'Nazione' }
                    referente:   { enabled: false, order: 80, required: false, label: 'Referente' }
                    telefono:    { enabled: false, order: 90, required: false, label: 'Telefono' }
                    email:       { enabled: false, order: 100, required: false, label: 'Email' }
                    note:        { enabled: true,  order: 110, required: false, label: 'Note' }

            causale:
                fields:
                    codice:        { enabled: true,  order: 10, required: true,  label: 'Codice' }
                    descrizione:   { enabled: true,  order: 20, required: true,  label: 'Descrizione' }
                    tipo:          { enabled: true,  order: 30, required: true,  label: 'Tipo movimento' }
                    segno:         { enabled: true,  order: 40, required: true,  label: 'Segno (carico/scarico/neutro)' }
                    aggiorna_giacenza: { enabled: true, order: 50, required: false, label: 'Aggiorna giacenza' }
                    impegna:       { enabled: false, order: 60, required: false, label: 'Impegna scorta' }
                    note:          { enabled: false, order: 70, required: false, label: 'Note' }

            movimento:
                form_sections:
                    testata: { enabled: true, label: 'Testata', order: 10, collapsed: false }
                    righe:   { enabled: true, label: 'Righe',   order: 20, collapsed: false }
                    note:    { enabled: true, label: 'Note',    order: 30, collapsed: true  }
                fields:
                    data:                { enabled: true,  section: testata, order: 10, required: true,  label: 'Data movimento' }
                    causale:             { enabled: true,  section: testata, order: 20, required: true,  label: 'Causale' }
                    magazzino_origine:   { enabled: true,  section: testata, order: 30, required: false, label: 'Magazzino origine' }
                    magazzino_destinazione: { enabled: true, section: testata, order: 40, required: false, label: 'Magazzino destinazione' }
                    riferimento_esterno: { enabled: false, section: testata, order: 50, required: false, label: 'Riferimento esterno' }
                    azienda_riferimento: { enabled: false, section: testata, order: 60, required: false, label: 'Azienda di riferimento (cliente/fornitore)' }
                    note:                { enabled: true,  section: note,    order: 10, required: false, label: 'Note' }
                list_columns:
                    numero:           { enabled: true,  order: 10, width: 100, label: 'N.' }
                    data:             { enabled: true,  order: 20, width: 120, label: 'Data' }
                    causale:          { enabled: true,  order: 30, width: 160, label: 'Causale' }
                    magazzino:        { enabled: true,  order: 40, width: 150, label: 'Magazzino' }
                    righe_count:      { enabled: true,  order: 50, width: 70,  label: 'Righe' }
                    stato:            { enabled: true,  order: 60, width: 90,  label: 'Stato' }

            giacenza:
                # Vista read-only: si configurano solo le colonne visualizzate
                list_columns:
                    articolo:          { enabled: true,  order: 10, width: 130, label: 'Articolo' }
                    descrizione:       { enabled: true,  order: 20, width: 280, label: 'Descrizione' }
                    magazzino:         { enabled: true,  order: 30, width: 140, label: 'Magazzino' }
                    ubicazione:        { enabled: true,  order: 40, width: 140, label: 'Ubicazione' }
                    lotto:             { enabled: false, order: 50, width: 120, label: 'Lotto' }
                    disponibile:       { enabled: true,  order: 60, width: 110, label: 'Disponibile' }
                    impegnata:         { enabled: true,  order: 70, width: 110, label: 'Impegnata' }
                    ordinata:          { enabled: false, order: 80, width: 110, label: 'Ordinata' }
                    um:                { enabled: true,  order: 90, width: 60,  label: 'UM' }
                    sotto_scorta:      { enabled: true,  order: 100, width: 50, label: '⚠' }
