apiVersion: webrobot.eu/v1alpha1
kind: VerticalApp
metadata:
  slug: ufficio-acquisti
  displayName: Ufficio Acquisti Agentico
  tagline:
    it: Dalla richiesta d'acquisto all'ordine nell'ERP, con agenti AI e approvazioni.
    en: From purchase request to ERP order, with AI agents and approvals.
  description:
    it: 'Il buyer descrive cosa serve (o carica il capitolato in PDF): gli agenti inviano le richieste
      di offerta ai fornitori, leggono le risposte, confrontano le offerte, preparano l''ordine, lo fanno
      approvare, lo registrano nell''ERP e inseguono conferme e consegne.'
    en: 'The buyer describes what is needed (or uploads the spec as PDF): agents send RFQs, read replies,
      compare offers, draft the order, get it approved, register it in the ERP and chase confirmations
      and deliveries.'
  langs:
  - it
  - en
  defaultLang: it
  timezone: Europe/Rome
spec:
  pattern: report
  branding:
    theme: light
    palette:
      primary: '#1f3a4d'
      accent: '#d9731a'
      background: '#f6f7f8'
      foreground: '#17222b'
    fonts:
      body: Inter
      display: IBM Plex Sans
    width: wide
    wordmark:
    - text: 'Ufficio '
      color: primary
    - text: Acquisti
      color: accent
    byline: agentico
  header:
    links:
    - label:
        it: Come funziona
        en: How it works
      href: '#come-funziona'
    - label:
        it: Approvazioni
        en: Approvals
      href: '#approvazioni'
    cta:
      label:
        it: Accedi
        en: Sign in
      href: /login
  auth:
    method: magic_link
    anonymous:
      views:
      - home
    roles:
    - key: admin
      label: Admin
      assignedBy: admin_emails
    - key: manager
      label:
        it: Responsabile acquisti
        en: Purchasing manager
      assignedBy: invite
    - key: user
      label: Buyer
      assignedBy: signup
  limits:
  - action: agent:rfq_writer
    per: user
    max: 10
    window: month
    plans:
      team_s: 40
      team_m: 150
      team_l: -1
  agents:
  - key: rfq_writer
    role: main
    description: Prepara la richiesta di offerta e la mette in coda per l'invio ai fornitori.
    profile:
      inline:
        display_name: RFQ writer
        crews:
        - id: rfq_writer
          engine: agent_sdk
          model: claude-sonnet-5-5
          max_turns: 14
          max_budget_usd: 0.8
          permission_mode: bypassPermissions
          disallowed_tools:
          - Bash
          - Read
          - Write
          - Edit
          - Glob
          - Grep
          - NotebookEdit
          - WebFetch
          - WebSearch
          system_prompt: 'Sei il primo agente dell''Ufficio Acquisti di un''azienda manifatturiera. Dalla
            richiesta del buyer (testo e/o capitolato/distinta allegati) prepari la richiesta di offerta
            (RFQ). Passi: 1) se ci sono file immagine o scansioni chiamali con read_upload; 2) genera
            un codice pratica nel formato RDA-AAAAMMGG-NNN; 3) salva la pratica con save_request (status
            ''sent'', buyer_email dell''utente); 4) per ogni fornitore indicato dal buyer cerca email
            e nome nell''anagrafica ERP con erp_suppliers; se il fornitore non c''è o manca l''email,
            NON inventarla: segnalalo nel report; 5) per ogni fornitore valido chiama queue_rfq con oggetto
            che inizia con ''[<codice pratica>]'', e un corpo cortese e preciso: articolo, specifiche
            tecniche, quantità, data di consegna richiesta, e richiesta esplicita di prezzo unitario,
            totale, tempi di consegna, condizioni di pagamento, ordine minimo, validità offerta, risposta
            con il codice pratica in oggetto. Non rivelare il budget del buyer ai fornitori. Report finale
            in Markdown, inizia con ''# RFQ <codice pratica> — <articolo>'', con sezioni ## Richiesta,
            ## Fornitori interpellati (tabella), ## Fornitori non inviati e motivo, ## Prossimi passi.
            Mai inventare dati.'
          mcp_servers: []
    goalTemplate: |-
      Articolo: {item}
      Specifiche: {specs}
      Quantità: {quantity} {?unit}{unit}{/unit}
      Data di consegna richiesta: {delivery_date}
      {?budget}Budget (riservato): {budget} EUR{/budget}
      Fornitori da interpellare: {suppliers}
      Email del buyer: {user}
      {?spec_doc}File allegati (id): {spec_doc}{/spec_doc}
      {?spec_doc_text}Testo del capitolato/distinta:
      {spec_doc_text}{/spec_doc_text}
      Oggi è {date}. Scrivi in lingua {lang}.
    appTools:
    - name: erp_suppliers
      description: 'Cerca nell''anagrafica fornitori dell''ERP (query: nome o codice)'
      action: http
      http:
        method: GET
        url: https://erp.azienda.example/api/suppliers
        attribution: ERP aziendale
        credential:
          provider: erp
          header: Authorization
          format: Bearer {secret}
    - name: save_request
      description: Crea o aggiorna una pratica di acquisto
      action: write
      collection: requests
      scope: all
    - name: queue_rfq
      description: Mette in coda l'email di richiesta offerta a un fornitore
      action: write
      collection: rfq_outbox
      scope: all
    - name: read_upload
      description: Legge un file caricato dall'utente (OCR incluso)
      action: read_file
    output: markdown
    limits:
      maxTurns: 14
      maxBudgetUsd: 0.8
  - key: quote_reader
    role: helper
    description: Legge le risposte dei fornitori arrivate in casella (anche PDF) ed estrae le condizioni.
    profile:
      inline:
        display_name: Quote reader
        crews:
        - id: quote_reader
          engine: agent_sdk
          model: claude-sonnet-5-5
          max_turns: 14
          max_budget_usd: 0.6
          permission_mode: bypassPermissions
          disallowed_tools:
          - Bash
          - Read
          - Write
          - Edit
          - Glob
          - Grep
          - NotebookEdit
          - WebFetch
          - WebSearch
          system_prompt: 'Sei il secondo agente dell''Ufficio Acquisti. Ricevi le email dei fornitori
            (testo e allegati). Individua il codice pratica nell''oggetto (''[RDA-...]''). Se manca o
            è ambiguo, non indovinare: scrivi nel report che serve assegnazione manuale. Se l''email è
            una risposta a una RFQ: leggi anche gli allegati PDF con read_upload e salva con save_quote:
            prezzo unitario, totale, valuta, tempi di consegna in giorni, condizioni di pagamento, ordine
            minimo, validità, note, buyer_email (dalla pratica, letta con read_requests). Se un dato non
            c''è lascialo vuoto, non stimarlo. Se l''email è una conferma d''ordine, aggiorna l''ordine
            con save_order (confirmation ''received'', status ''confirmed'', eventuale nuova data di consegna).
            Dopo aver salvato un''offerta, confronta il numero di offerte ricevute con i fornitori interpellati:
            se sono tutte arrivate, aggiorna la pratica con save_request status ''quotes_ready''. Report
            breve in Markdown che inizia con ''# Risposta fornitore — <fornitore> — <codice pratica>''.'
          mcp_servers: []
    goalTemplate: |-
      Nuova email ricevuta nella casella acquisti:
      {message}
    appTools:
    - name: read_requests
      description: Legge le pratiche di acquisto
      action: read
      collection: requests
      scope: all
    - name: save_request
      description: Crea o aggiorna una pratica di acquisto
      action: write
      collection: requests
      scope: all
    - name: save_quote
      description: Salva l'offerta estratta da una risposta
      action: write
      collection: quotes
      scope: all
    - name: save_order
      description: Crea o aggiorna un ordine
      action: write
      collection: orders
      scope: all
    - name: read_upload
      description: Legge un allegato (PDF, scansione) ricevuto
      action: read_file
    output: markdown
    limits:
      maxTurns: 14
      maxBudgetUsd: 0.6
  - key: comparer
    role: analyst
    description: Confronta le offerte, propone il fornitore migliore e prepara la bozza d'ordine.
    profile:
      inline:
        display_name: Offer comparer
        crews:
        - id: comparer
          engine: agent_sdk
          model: claude-sonnet-5-5
          max_turns: 10
          max_budget_usd: 0.6
          permission_mode: bypassPermissions
          disallowed_tools:
          - Bash
          - Read
          - Write
          - Edit
          - Glob
          - Grep
          - NotebookEdit
          - WebFetch
          - WebSearch
          system_prompt: 'Sei il terzo agente dell''Ufficio Acquisti. Leggi la pratica (read_requests)
            e tutte le offerte (read_quotes) del codice pratica indicato. Confronta in una tabella: fornitore,
            prezzo unitario, totale, tempi, pagamento, ordine minimo, validità, rispetto di budget e data
            di consegna. Segnala offerte incomplete o non conformi (es. ordine minimo sopra la quantità,
            consegna oltre la data). Proponi il fornitore migliore motivando la scelta (costo totale,
            tempi, rischio, condizioni) e indica l''alternativa. Non inventare dati mancanti. Prepara
            la bozza d''ordine (fornitore, articolo, quantità, prezzo, totale, consegna, pagamento). Poi
            aggiorna la pratica con save_request (status ''comparing'', chosen_supplier, chosen_amount)
            e chiama request_buyer_ok per far approvare al buyer la bozza. Se il totale supera 5000 EUR
            avverti nel report che servirà anche l''approvazione del responsabile acquisti. Report Markdown
            che inizia con ''# Confronto offerte <codice pratica> — <articolo>'', sezioni ## Tabella comparativa,
            ## Fornitore proposto, ## Alternative e rischi, ## Bozza d''ordine. Aggiungi un grafico ```chart```
            a barre dei totali per fornitore con valori reali.'
          mcp_servers: []
    appTools:
    - name: read_requests
      description: Legge le pratiche di acquisto
      action: read
      collection: requests
      scope: all
    - name: read_quotes
      description: Legge le offerte dei fornitori
      action: read
      collection: quotes
      scope: all
    - name: save_request
      description: Crea o aggiorna una pratica di acquisto
      action: write
      collection: requests
      scope: all
    awaits:
    - buyer_ok
    output: markdown
    limits:
      maxTurns: 10
      maxBudgetUsd: 0.6
  - key: orderer
    role: helper
    description: Dopo le approvazioni registra l'ordine nell'ERP e lo invia al fornitore.
    profile:
      inline:
        display_name: Order placer
        crews:
        - id: orderer
          engine: agent_sdk
          model: claude-sonnet-5-5
          max_turns: 10
          max_budget_usd: 0.5
          permission_mode: bypassPermissions
          disallowed_tools:
          - Bash
          - Read
          - Write
          - Edit
          - Glob
          - Grep
          - NotebookEdit
          - WebFetch
          - WebSearch
          system_prompt: 'Sei l''agente ordini dell''Ufficio Acquisti. Parti da una pratica con bozza
            d''ordine approvata dal buyer. Leggi pratica e offerta scelta (read_requests, read_quotes).
            Regola: se il totale supera 5000 EUR e l''approvazione del responsabile acquisti NON è ancora
            stata data (nel goal trovi ''manager_approved: yes'' solo se data), chiama request_manager_ok
            con fornitore, importo e motivazione e fermati. Altrimenti: 1) registra l''ordine nell''ERP
            con erp_create_order (POST JSON: supplier, item, quantity, unit_price, total, currency, delivery_date,
            payment_terms, request_id); 2) se l''ERP fallisce NON dire che l''ordine è registrato: scrivilo
            chiaramente e non inviare nulla; 3) altrimenti salva l''ordine con save_order (status ''ordered'',
            confirmation ''pending'', delivery_received ''no'', order_date di oggi, erp_ref restituito,
            supplier_email, buyer_email) — l''ordine parte al fornitore da questa registrazione; 4) aggiorna
            la pratica con save_request status ''ordered''. Report Markdown che inizia con ''# Ordine
            <codice> — <fornitore>''.'
          mcp_servers: []
    appTools:
    - name: read_requests
      description: Legge le pratiche di acquisto
      action: read
      collection: requests
      scope: all
    - name: read_quotes
      description: Legge le offerte dei fornitori
      action: read
      collection: quotes
      scope: all
    - name: save_request
      description: Crea o aggiorna una pratica di acquisto
      action: write
      collection: requests
      scope: all
    - name: save_order
      description: Crea o aggiorna un ordine
      action: write
      collection: orders
      scope: all
    - name: erp_create_order
      description: Registra un ordine di acquisto nell'ERP aziendale
      action: http
      http:
        method: POST
        url: https://erp.azienda.example/api/purchase-orders
        attribution: ERP aziendale
        credential:
          provider: erp
          header: Authorization
          format: Bearer {secret}
    awaits:
    - manager_ok
    output: markdown
    limits:
      maxTurns: 10
      maxBudgetUsd: 0.5
  - key: expediter
    role: helper
    description: Segue conferme d'ordine e ritardi di consegna e scrive i solleciti.
    profile:
      inline:
        display_name: Order expediter
        crews:
        - id: expediter
          engine: agent_sdk
          model: claude-sonnet-5-5
          max_turns: 8
          max_budget_usd: 0.3
          permission_mode: bypassPermissions
          disallowed_tools:
          - Bash
          - Read
          - Write
          - Edit
          - Glob
          - Grep
          - NotebookEdit
          - WebFetch
          - WebSearch
          system_prompt: Sei l'agente solleciti dell'Ufficio Acquisti. Per l'ordine indicato (read_orders)
            verifica lo stato. Se la conferma d'ordine non è arrivata (confirmation 'pending'), scrivi
            un sollecito di conferma; se la consegna è prevista per una data passata e delivery_received
            è 'no', segna l'ordine come 'late' con save_order e scrivi un sollecito di consegna che chiede
            data certa. Se la merce risulta già ricevuta (delivery_received 'yes') o non serve nulla,
            dillo e non scrivere nulla. Per ogni sollecito usa queue_followup (order_id, buyer_email,
            supplier_email, subject che inizia con il codice pratica, body in tono professionale, fermo
            e cortese, kind 'confirmation' o 'delivery'). Non minacciare penali non previste. Report Markdown
            che inizia con '# Sollecito ordine <codice> — <fornitore>'.
          mcp_servers: []
    appTools:
    - name: read_orders
      description: Legge gli ordini
      action: read
      collection: orders
      scope: all
    - name: save_order
      description: Crea o aggiorna un ordine
      action: write
      collection: orders
      scope: all
    - name: queue_followup
      description: Mette in coda un sollecito email al fornitore
      action: write
      collection: followups
      scope: all
    output: markdown
    limits:
      maxTurns: 8
      maxBudgetUsd: 0.3
  inputForm:
    title:
      it: Nuova richiesta di acquisto
      en: New purchase request
    fields:
    - name: item
      type: text
      required: true
      label:
        it: Articolo
        en: Item
    - name: specs
      type: textarea
      maxLength: 3000
      label:
        it: Specifiche
        en: Specifications
    - name: quantity
      type: number
      required: true
      label:
        it: Quantità
        en: Quantity
    - name: unit
      type: text
      label:
        it: Unità (pz, kg, m…)
        en: Unit
    - name: delivery_date
      type: date
      required: true
      label:
        it: Data di consegna
        en: Delivery date
    - name: budget
      type: number
      label:
        it: Budget (EUR)
        en: Budget (EUR)
    - name: suppliers
      type: textarea
      required: true
      maxLength: 1000
      label:
        it: Fornitori da interpellare
        en: Suppliers to contact
      help:
        it: Nomi o codici ERP, uno per riga
        en: Names or ERP codes, one per line
    - name: spec_doc
      type: file
      accept:
      - pdf
      - docx
      - xlsx
      - csv
      - jpg
      - png
      maxMb: 15
      multiple: true
      label:
        it: Capitolato o distinta (PDF)
        en: Specification or BOM (PDF)
  data:
    collections:
    - name: requests
      ownedBy: org
      description: Pratiche di acquisto
      fields:
      - name: request_id
        type: text
        label: Pratica
      - name: buyer_email
        type: email
        label: Buyer
      - name: item
        type: text
        label: Articolo
      - name: specs
        type: textarea
        label: Specifiche
      - name: quantity
        type: number
        label: Quantità
      - name: unit
        type: text
        label: Unità
      - name: delivery_date
        type: date
        label: Consegna
      - name: budget
        type: number
        label: Budget
      - name: suppliers
        type: textarea
        label: Fornitori
      - name: status
        type: select
        label: Stato
        options:
        - sent
        - quotes_ready
        - comparing
        - approved
        - ordered
        - closed
      - name: chosen_supplier
        type: text
        label: Fornitore scelto
      - name: chosen_amount
        type: number
        label: Importo scelto
      access:
      - role: user
        where:
          buyer_email: '{user.email}'
        can:
        - read
      - role: manager
        can:
        - read
        - write
    - name: rfq_outbox
      ownedBy: org
      description: Email di richiesta offerta da inviare
      fields:
      - name: request_id
        type: text
      - name: buyer_email
        type: email
      - name: supplier_name
        type: text
      - name: supplier_email
        type: email
      - name: subject
        type: text
      - name: body
        type: textarea
      access:
      - role: user
        where:
          buyer_email: '{user.email}'
        can:
        - read
      - role: manager
    - name: quotes
      ownedBy: org
      description: Offerte estratte dalle risposte dei fornitori
      fields:
      - name: request_id
        type: text
        label: Pratica
      - name: buyer_email
        type: email
      - name: supplier_name
        type: text
        label: Fornitore
      - name: supplier_email
        type: email
      - name: unit_price
        type: number
        label: Prezzo unit.
      - name: total
        type: number
        label: Totale
      - name: currency
        type: text
        label: Valuta
      - name: lead_time_days
        type: number
        label: Consegna (gg)
      - name: payment_terms
        type: text
        label: Pagamento
      - name: min_order
        type: text
        label: Ordine minimo
      - name: validity
        type: text
        label: Validità
      - name: notes
        type: textarea
        label: Note
      access:
      - role: user
        where:
          buyer_email: '{user.email}'
        can:
        - read
      - role: manager
    - name: orders
      ownedBy: org
      description: Ordini registrati
      fields:
      - name: order_id
        type: text
        label: Ordine
      - name: request_id
        type: text
        label: Pratica
      - name: buyer_email
        type: email
      - name: supplier_name
        type: text
        label: Fornitore
      - name: supplier_email
        type: email
      - name: amount
        type: number
        label: Importo
      - name: currency
        type: text
        label: Valuta
      - name: order_date
        type: date
        label: Data ordine
      - name: delivery_date
        type: date
        label: Consegna prevista
      - name: status
        type: select
        label: Stato
        options:
        - ordered
        - confirmed
        - late
        - delivered
      - name: confirmation
        type: select
        label: Conferma
        options:
        - pending
        - received
      - name: delivery_received
        type: select
        label: Merce ricevuta
        options:
        - 'no'
        - 'yes'
      - name: erp_ref
        type: text
        label: Rif. ERP
      access:
      - role: user
        where:
          buyer_email: '{user.email}'
        can:
        - read
        - write
      - role: manager
        can:
        - read
        - write
    - name: followups
      ownedBy: org
      description: Solleciti ai fornitori
      fields:
      - name: order_id
        type: text
      - name: buyer_email
        type: email
      - name: supplier_email
        type: email
      - name: subject
        type: text
      - name: body
        type: textarea
      - name: kind
        type: select
        options:
        - confirmation
        - delivery
      access:
      - role: user
        where:
          buyer_email: '{user.email}'
        can:
        - read
      - role: manager
    credentials:
    - provider: erp
      kind: api_key
      scope: org
      label:
        it: ERP aziendale
        en: Company ERP
      help:
        it: Chiave API dell'ERP per leggere l'anagrafica fornitori e registrare gli ordini (impostata
          dagli admin).
        en: ERP API key to read suppliers and register orders (set by admins).
  approvals:
  - key: buyer_ok
    title:
      it: Approva la bozza d'ordine
      en: Approve the draft order
    description: Il buyer conferma fornitore e bozza d'ordine proposti dall'agente
    decidedBy: requester
    timeoutMinutes: 10080
  - key: manager_ok
    title:
      it: Approvazione responsabile acquisti (sopra soglia)
      en: Purchasing manager approval (above threshold)
    description: Ordini sopra 5000 EUR
    role: manager
    timeoutMinutes: 10080
    onTimeout: reject
  triggers:
  - key: rfq_send
    'on':
      collection: rfq_outbox
      op: insert
    notify:
      to: record.supplier_email
      subject: '{record.subject}'
      body: '{record.body}'
  - key: compare_start
    'on':
      collection: requests
      op: update
      where:
        status: quotes_ready
    start:
      agent: comparer
    goal: Confronta le offerte della pratica {record.request_id} ({record.item}), buyer {record.buyer_email}.
      Prepara la bozza d'ordine e chiedi l'approvazione del buyer.
  - key: after_buyer_ok
    'on':
      approval: buyer_ok
      decision: approved
    start:
      agent: orderer
    goal: 'Il buyer ha approvato la bozza d''ordine. Evento: {event}. Procedi come da istruzioni (soglia
      5000 EUR). manager_approved: no'
  - key: after_manager_ok
    'on':
      approval: manager_ok
      decision: approved
    start:
      agent: orderer
    goal: 'Il responsabile acquisti ha approvato. Evento: {event}. Registra l''ordine nell''ERP e salvalo.
      manager_approved: yes'
  - key: order_send
    'on':
      collection: orders
      op: insert
      where:
        status: ordered
    notify:
      to:
      - record.supplier_email
      - record.buyer_email
      subject: Ordine di acquisto {record.order_id} — pratica {record.request_id}
      body: |-
        Buongiorno,
        vi confermiamo l'ordine {record.order_id} (pratica {record.request_id}) per un importo di {record.amount} {record.currency}, consegna prevista {record.delivery_date}.
        Vi preghiamo di inviare conferma d'ordine rispondendo a questa email con il codice pratica in oggetto.
        Grazie.
      link: orders
  - key: followup_send
    'on':
      collection: followups
      op: insert
    notify:
      to:
      - record.supplier_email
      - record.buyer_email
      subject: '{record.subject}'
      body: '{record.body}'
  - key: chase_confirmation
    'on':
      date:
        collection: orders
        field: order_date
        offsetDays: 2
        hour: 8
    start:
      agent: expediter
    goal: 'Controlla se per l''ordine {record.order_id} è arrivata la conferma del fornitore {record.supplier_name};
      se no scrivi il sollecito. Stato conferma: {record.confirmation}.'
  - key: chase_delivery
    'on':
      date:
        collection: orders
        field: delivery_date
        offsetDays: 1
        hour: 8
    start:
      agent: expediter
    goal: 'L''ordine {record.order_id} del fornitore {record.supplier_name} aveva consegna prevista {record.delivery_date}.
      Merce ricevuta: {record.delivery_received}. Se la merce risulta non ricevuta segnala il ritardo
      e scrivi il sollecito di consegna; se è già ricevuta non fare nulla.'
  views:
  - key: home
    type: page
    title: Ufficio Acquisti Agentico
    nav: false
    sections:
    - type: hero
      eyebrow:
        it: Per i buyer delle aziende manifatturiere
        en: For manufacturing buyers
      title:
        it: Dalla richiesta all'**ordine nell'ERP**, senza rincorrere le email.
        en: From request to **ERP order**, without chasing emails.
      text:
        it: Descrivi cosa ti serve o carica il capitolato in PDF. Gli agenti scrivono ai fornitori, leggono
          le offerte, le confrontano e preparano l'ordine. Tu approvi, loro lo registrano e inseguono
          le consegne.
        en: Describe what you need or upload the spec as PDF. Agents write to suppliers, read the offers,
          compare them and draft the order. You approve; they register it and chase deliveries.
      actions:
      - label:
          it: Nuova richiesta
          en: New request
        href: /v/new
        style: primary
      - label:
          it: Accedi
          en: Sign in
        href: /login
        style: ghost
      band: true
    - type: steps
      id: come-funziona
      title:
        it: Come funziona
        en: How it works
      items:
      - title:
          it: RFQ ai fornitori
          en: RFQs to suppliers
        text:
          it: L'agente legge l'anagrafica dall'ERP e invia la richiesta di offerta via email.
          en: The agent reads suppliers from the ERP and emails the RFQ.
        badge: '1'
      - title:
          it: Lettura delle risposte
          en: Reading replies
        text:
          it: Prezzi, tempi, pagamento e minimi estratti dalle email e dai PDF allegati.
          en: Prices, lead times, payment terms and minimums extracted from emails and PDFs.
        badge: '2'
      - title:
          it: Confronto e bozza d'ordine
          en: Comparison and draft order
        text:
          it: Tabella comparativa, fornitore consigliato con motivazione, bozza d'ordine.
          en: Comparison table, recommended supplier with rationale, draft order.
        badge: '3'
      - title:
          it: Approvazione, ERP, solleciti
          en: Approval, ERP, chasing
        text:
          it: Ordine registrato nell'ERP dopo l'ok; conferme e ritardi inseguiti con solleciti.
          en: Order registered in the ERP after approval; confirmations and delays chased.
        badge: '4'
    - type: cards
      id: approvazioni
      title:
        it: Approvazioni
        en: Approvals
      items:
      - title: Buyer
        text:
          it: Nessun ordine parte senza il tuo ok.
          en: No order goes out without your OK.
      - title:
          it: Responsabile acquisti
          en: Purchasing manager
        text:
          it: Sopra la soglia di importo serve anche la sua approvazione. Vede tutte le pratiche.
          en: Above the amount threshold his approval is needed too. Sees all cases.
    - type: note
      content:
        it: 'Supporto alle decisioni d''acquisto: verifica sempre i dati prima di impegnare l''azienda.'
        en: 'Purchasing decision support: always check the data before committing the company.'
  - key: new
    type: new_run
    title:
      it: Nuova richiesta
      en: New request
    roles:
    - user
    - manager
    - admin
  - key: runs
    type: history
    title:
      it: Le mie RFQ
      en: My RFQs
    source: run
    roles:
    - user
    - manager
    - admin
  - key: report
    type: report
    source: run
    printable: true
    nav: false
  - key: requests
    type: table
    title:
      it: Pratiche
      en: Cases
    source: collection:requests
    columns:
    - request_id
    - item
    - quantity
    - delivery_date
    - status
    - chosen_supplier
    - chosen_amount
    export: true
    roles:
    - user
    - manager
    - admin
  - key: quotes
    type: table
    title:
      it: Offerte ricevute
      en: Offers received
    source: collection:quotes
    columns:
    - request_id
    - supplier_name
    - unit_price
    - total
    - lead_time_days
    - payment_terms
    - min_order
    - validity
    export: true
    roles:
    - user
    - manager
    - admin
  - key: orders
    type: table
    title:
      it: Ordini
      en: Orders
    source: collection:orders
    columns:
    - order_id
    - request_id
    - supplier_name
    - amount
    - delivery_date
    - status
    - confirmation
    - delivery_received
    - erp_ref
    export: true
    roles:
    - user
    - manager
    - admin
  - key: order_update
    type: form
    title:
      it: Aggiorna ordine
      en: Update order
    collection: orders
    fields:
    - status
    - delivery_date
    - delivery_received
    edit: true
    submit:
      label:
        it: Salva
        en: Save
      message:
        it: Ordine aggiornato
        en: Order updated
      redirect: orders
    nav: false
    roles:
    - user
    - manager
    - admin
  - key: approvals
    type: approvals
    title:
      it: Approvazioni
      en: Approvals
    approvals:
    - buyer_ok
    - manager_ok
    roles:
    - user
    - manager
    - admin
  - key: account
    type: account
    title:
      it: Abbonamento
      en: Subscription
    roles:
    - user
    - manager
    - admin
  billing:
    modes:
    - subscription
    - credits
    currency: eur
    signupCredits: 20
    metering:
      creditEur: 0.01
      markupPct: 50
      drivers:
      - llm_tokens
      - compute
    costs:
      agent:rfq_writer:
        estimate: 10
        metered: true
      agent:comparer:
        estimate: 10
        metered: true
    packs:
    - key: rfq_50
      credits: 500
      price: 20
      label: +500 crediti
    plans:
    - key: team_s
      price: 149
      interval: month
      label: Team S — fino a 3 utenti, 40 richieste/mese
      credits: 400
      creditsReset: monthly
      roles:
      - admin
      - manager
    - key: team_m
      price: 399
      interval: month
      label: Team M — fino a 10 utenti, 150 richieste/mese
      credits: 1500
      creditsReset: monthly
      roles:
      - admin
      - manager
    - key: team_l
      price: 899
      interval: month
      label: Team L — utenti e richieste illimitati
      credits: 5000
      creditsReset: monthly
      roles:
      - admin
      - manager
  notifications:
    emailOnRunDone: true
  channels:
  - key: offers_inbox
    type: email
    agent: quote_reader
  egress:
    hosts:
    - erp.azienda.example
    notes: 'Host dell''ERP aziendale: sostituire con l''host reale dell''API ERP del cliente (anagrafica
      fornitori in lettura, ordini di acquisto in scrittura).'
  extensions:
  - key: mailbox_oauth
    description: 'Collegamento diretto alla casella aziendale (Microsoft 365/Google) via OAuth non disponibile:
      le RFQ partono dalla piattaforma e le risposte dei fornitori arrivano nell''inbox email dell''app
      (channel offers_inbox), da inoltrare o impostare come risposta.'
  - key: erp_endpoints
    description: Gli endpoint ERP (/api/suppliers, /api/purchase-orders) e il formato dei campi vanno
      adattati all'ERP reale del cliente.
  - key: seat_pricing
    description: Il prezzo per numero di utenti è espresso con i piani Team S/M/L; il limite di utenti
      per piano non è imposto dal runtime. La soglia di 5000 EUR per il responsabile è nel prompt degli
      agenti comparer e orderer.
