import { WithMongooseProps } from './with-mongoose-props' import { WithTenantProps } from './with-tenant-props' import { WithTranslations } from './with-translations' import { Document } from './document' import { AggregationPage } from './aggregation-page' import { WebAppCategory } from './category' import { EntityType } from './entity-type' import { TenderType, TenderPhaseType, TenderPhaseStatus, TenderProcedureType, TenderContractSector, NoticeType, DebateType, EvaluationOutcome, SponsorshipType, InterventionType } from '../constants' // ============================================ // Public Debate Schema (shared with Announcement) // ============================================ export type TenderPublicDebate = { debateType?: DebateType debateDocumentId?: string debateDocument?: Document debateOutcomeId?: string debateOutcome?: Document } // ============================================ // Evaluation Committee Schema // ============================================ export type TenderEvaluationCommittee = { hasCommittee?: boolean composition?: string compositionDocumentId?: string compositionDocument?: Document membersCount?: number membersCvIds?: string[] membersCvs?: Document[] nominationActId?: string nominationAct?: Document } // ============================================ // Equal Opportunities Schema (PNRR/PNC) // ============================================ export type TenderEqualOpportunities = { hasOver50Employees?: boolean genderReportId?: string genderReport?: Document } // ============================================ // Technical Board Schema // ============================================ export type TenderTechnicalBoard = { hasBoard?: boolean composition?: string compositionDocumentId?: string compositionDocument?: Document membersCount?: number nominationActId?: string nominationAct?: Document } // ============================================ // Post Contract Compliance Schema // ============================================ export type TenderPostContractCompliance = { hasCompliance?: boolean complianceReportId?: string complianceReport?: Document verificationDate?: string } // ============================================ // Tender Phase Types // ============================================ export type TenderPhaseBase = WithMongooseProps< WithTenantProps<{ tenderId: string phaseType: TenderPhaseType status: TenderPhaseStatus publishedAt?: string bdncpLink?: string updatedById?: string }> > export type TenderPublicationPhase = TenderPhaseBase & { phaseType: 'Publication' publicDebate?: TenderPublicDebate contractingResolutionId?: string contractingResolution?: Document noticeType?: NoticeType noticeId?: string notice?: Document disciplinaryId?: string disciplinary?: Document technicalSpecificationsId?: string technicalSpecifications?: Document contractConditionsId?: string contractConditions?: Document } export type TenderAwardPhase = TenderPhaseBase & { phaseType: 'Award' evaluationCommittee?: TenderEvaluationCommittee equalOpportunities?: TenderEqualOpportunities awardResolutionId?: string awardResolution?: Document awardDate?: string winnerName?: string winnerVatNumber?: string awardAmount?: number } export type TenderExecutionPhase = TenderPhaseBase & { phaseType: 'Execution' technicalBoard?: TenderTechnicalBoard postContractCompliance?: TenderPostContractCompliance contractId?: string contract?: Document contractStartDate?: string contractEndDate?: string contractAmount?: number salId?: string sal?: Document completionCertificateId?: string completionCertificate?: Document regularExecutionCertificateId?: string regularExecutionCertificate?: Document collaudoId?: string collaudo?: Document } export type TenderSponsorshipPhase = TenderPhaseBase & { phaseType: 'Sponsorship' sponsorshipType?: SponsorshipType sponsorshipNoticeId?: string sponsorshipNotice?: Document sponsorshipContractId?: string sponsorshipContract?: Document sponsorName?: string sponsorshipValue?: number } export type TenderProjectFinancePhase = TenderPhaseBase & { phaseType: 'ProjectFinance' proposalId?: string proposal?: Document feasibilityStudyId?: string feasibilityStudy?: Document evaluationOutcome?: EvaluationOutcome evaluationReportId?: string evaluationReport?: Document } export type TenderLocalPublicServicePhase = TenderPhaseBase & { phaseType: 'LocalPublicService' serviceContractId?: string serviceContract?: Document serviceCharterId?: string serviceCharter?: Document qualityReportIds?: string[] qualityReports?: Document[] } export type TenderEmergencyPhase = TenderPhaseBase & { phaseType: 'Emergency' interventionType?: InterventionType emergencyDecreeId?: string emergencyDecree?: Document urgencyReportId?: string urgencyReport?: Document completionReportId?: string completionReport?: Document emergencyAmount?: number } export type TenderPhase = | TenderPublicationPhase | TenderAwardPhase | TenderExecutionPhase | TenderSponsorshipPhase | TenderProjectFinancePhase | TenderLocalPublicServicePhase | TenderEmergencyPhase // ============================================ // Tender Translations // ============================================ export type TenderTranslations = { object: string // titolo del bando di gara } // ============================================ // RUP (Responsabile Unico del Procedimento) // ============================================ export type TenderRup = { name: string // Nome e cognome del RUP fiscalCode?: string // Codice fiscale del RUP role?: string // Ruolo/qualifica email?: string // Email di contatto phone?: string // Telefono di contatto } // ============================================ // Tender Main Type // ============================================ export type Tender = WithMongooseProps< WithTenantProps< TenderTranslations & { // === Identificativi obbligatori ANAC === cigCode?: string // CIG - Codice Identificativo Gara cupCode?: string // CUP - Codice Unico Progetto (obbligatorio per lavori pubblici) // === Importi === baseAmount?: number // Importo a base di gara (IVA esclusa) safetyAmount?: number // Importo oneri sicurezza non soggetti a ribasso // === Tempi di completamento === durationDays?: number // Durata prevista in giorni durationMonths?: number // Durata prevista in mesi (alternativo) // === Procedura e settore === procedureType?: TenderProcedureType // Procedura di scelta del contraente contractSector?: TenderContractSector // Settore: Lavori, Servizi, Forniture // === RUP - Responsabile Unico del Procedimento === rup?: TenderRup // === Struttura proponente === proposingStructure?: string // Denominazione struttura proponente proposingStructureCode?: string // Codice fiscale struttura proponente // === Date === publishedDate: string expirationDate: string // === Stato === isActive: boolean isPublished: boolean // === Tipologia bando === tenderType?: TenderType // === Relazioni === aggregationPageIds?: string[] aggregationPages?: AggregationPage[] targetPageIds?: string[] targetPages?: AggregationPage[] categoryId?: string category?: WebAppCategory entityTypeId?: string entityType?: EntityType // === Traduzioni e URL === translations: WithTranslations pageUrl: string // === Fasi del bando === currentPhaseId?: string currentPhaseType?: TenderPhaseType currentPhase?: TenderPhase phases?: TenderPhase[] // === Sistema === expirationJobId?: string updatedById?: string } > >