/**
 * Procurement Reform (Scotland) Act 2014 Compliance Pack
 *
 * Statute: Procurement Reform (Scotland) Act 2014 (asp 12) +
 *   Procurement (Scotland) Regulations 2016 + Procurement Reform
 *   (Scotland) Regulations 2016. Scotland's parallel procurement regime
 *   distinct from the UK Procurement Act 2023 which applies in England,
 *   Wales, NI but NOT Scotland.
 *
 * Jurisdiction: Scotland
 * Authority: Scottish Government + Scottish Procurement Service +
 *   Audit Scotland
 *
 * Why this pack (separate from `uk-procurement-act`):
 *   - GB Procurement Act 2023 does NOT apply in Scotland.
 *   - Scotland uses Procurement Reform (Scotland) Act 2014 with
 *     distinctive sustainable-procurement duty + community-benefits
 *     requirements.
 *   - Public-sector AI suppliers procuring in Scotland need this pack,
 *     not the GB Procurement Act 2023 pack.
 *
 * Distinctive Scottish obligations:
 *   - **Sustainable procurement duty** (s.9) — economic, social,
 *     environmental wellbeing
 *   - **Community benefits** (s.25) — required for >£4M contracts
 *   - **Procurement strategy + annual report** (ss.15-19) — public
 *     authority obligation
 *   - **Living Wage** preference + Fair Work First considerations
 *   - **Single Procurement Document Scotland (sPDS)**
 *   - **Public Contracts Scotland (PCS)** portal — mandatory listing
 *
 * @connexum/ai-governance
 */
export const SCOTLAND_PROCUREMENT_CATEGORY_CLASSIFIERS = {
    SUSTAINABLE_PROCUREMENT_DUTY: {
        references: ['Procurement Reform (Scotland) Act 2014 s.9'],
        classifier: (i) => /\b(?:sustainable\s+procurement\s+duty|s\.?\s*9\s+procurement\s+reform\s+scotland|fair\s+work\s+first)\b/i.test(i),
    },
    COMMUNITY_BENEFITS: {
        references: ['Procurement Reform (Scotland) Act 2014 s.25 — community benefits'],
        classifier: (i) => /\b(?:community\s+benefits\s+(?:scotland|s\.?\s*25)|community\s+benefit\s+clause\s+procurement)\b/i.test(i),
    },
    PROCUREMENT_STRATEGY_SCOTLAND: {
        references: ['Procurement Reform (Scotland) Act 2014 ss.15-19'],
        classifier: (i) => /\b(?:procurement\s+strategy\s+scotland|procurement\s+annual\s+report\s+scotland|s\.?\s*15\s+procurement\s+scotland)\b/i.test(i),
    },
    SPDS_DOCUMENT: {
        references: ['Single Procurement Document Scotland (sPDS)'],
        classifier: (i) => /\b(?:single\s+procurement\s+document\s+scotland|spds\s+(?:scotland|return)|spds)\b/i.test(i),
    },
    PCS_LISTING: {
        references: ['Public Contracts Scotland portal listing'],
        classifier: (i) => /\b(?:public\s+contracts\s+scotland|pcs\s+(?:portal|listing|notice)|pcs[\s-]?tender)\b/i.test(i),
    },
    CREDENTIALS: {
        references: ['Cross-pack secrets safety'],
        classifier: (i) => {
            if (/\b(?:api[_-]?key|apikey)\s*[=:]\s*["']?[A-Za-z0-9_\-\/+]{16,}["']?/i.test(i))
                return true;
            if (/\bpassword\s*[=:]\s*["']?[A-Za-z0-9!@#$%^&*_\-]{8,}["']?/i.test(i))
                return true;
            if (/-----BEGIN\s+(?:RSA\s+)?PRIVATE\s+KEY-----/.test(i))
                return true;
            return false;
        },
    },
};
export const SCOTLAND_PROCUREMENT_PACK = {
    categoryClassifiers: SCOTLAND_PROCUREMENT_CATEGORY_CLASSIFIERS,
    id: 'scotland-procurement-reform',
    aliases: ['scotland-procurement', 'procurement-reform-scotland', 'procurement-reform-scotland-act-2014', 'asp-2014-12'],
    name: 'Procurement Reform (Scotland) Act 2014',
    version: '1.0.0',
    contentHash: '3af43ab63476396cd8cea2972feee7a7725098a5ef19d40b58163a3b2ef64935',
    description: 'Scottish procurement regime distinct from GB Procurement Act 2023 (which does NOT apply in Scotland). Sustainable procurement duty (s.9: economic + social + environmental wellbeing), community benefits requirements (s.25: >£4M contracts), procurement strategy + annual report (ss.15-19), Fair Work First + Living Wage preference, Single Procurement Document Scotland (sPDS), Public Contracts Scotland (PCS) portal listing. Scotland-deployed AI public-sector procurement uses this pack, not `uk-procurement-act`.',
    authority: 'Scottish Government + Scottish Procurement Service + Audit Scotland',
    industries: ['public-sector', 'technology', 'professional-services', 'critical-national-infrastructure'],
    requiredModules: [
        { name: 'attestation-manager', required: true, reason: 'Procurement strategy + annual report; sustainable-procurement duty attestation; community-benefits commitments tracking; sPDS submission.', reference: 'PR(S)A 2014 ss.9, 15-19, 25' },
        { name: 'governance-runtime', required: true, reason: 'Default-deny on >£4M contract awards lacking community-benefits clause; sustainable-procurement gate.', reference: 'PR(S)A 2014 s.25' },
        { name: 'event-bus', required: true, reason: 'PCS portal listing routing; community-benefit milestone events; procurement-strategy review reminders.', reference: 'PR(S)A 2014 ss.15-19' },
        { name: 'audit-integrity', required: true, reason: 'Tamper-evident audit chain for procurement strategy revisions, annual reports, community-benefit commitments.', reference: 'PR(S)A 2014 evidence integrity' },
        { name: 'data-classifier', required: true, reason: 'Surface PR(S)A evidence categories.', reference: 'PR(S)A evidence categorisation' },
        { name: 'transparency-injector', required: true, reason: 'PCS public listing; annual procurement report publication.', reference: 'PR(S)A 2014 publication duties' },
        { name: 'approval-queue', required: true, reason: 'Senior approval on community-benefits clause inclusion; sustainable-procurement assessment sign-off.', reference: 'PR(S)A 2014 governance' },
        { name: 'session-persistence', required: true, reason: '6-year retention (Limitation NI rules apply in Scotland too via Prescription and Limitation (Scotland) Act 1973).', reference: 'Prescription and Limitation (Scotland) Act 1973' },
        { name: 'supply-chain', required: true, reason: 'Sub-contractor Fair Work First flow-down; community-benefits cascade.', reference: 'PR(S)A 2014 sub-contractor accountability' },
        { name: 'agent-auth', required: true, reason: 'Named procurement officer; conflicts-of-interest binding.', reference: 'PR(S)A 2014 governance' },
    ],
    moduleConfig: {
        'attestation-manager': { procurementStrategyTracked: true, annualReportTracked: true, sustainableProcurementDutyAttestationRequired: true, communityBenefitsCommitmentTracked: true, spdsSubmissionTracked: true },
        'governance-runtime': { communityBenefitsGateRequired: true, sustainableProcurementGateRequired: true, communityBenefitsContractValueThresholdGbp: 4000000 },
        'event-bus': { pcsListingRoutingRequired: true, communityBenefitMilestoneEventsRequired: true },
        'audit-integrity': { prsaEvidenceTrackingRequired: true },
        'data-classifier': { enabledCategories: ['SUSTAINABLE_PROCUREMENT_DUTY', 'COMMUNITY_BENEFITS', 'PROCUREMENT_STRATEGY_SCOTLAND', 'SPDS_DOCUMENT', 'PCS_LISTING', 'CREDENTIALS'], credentialsAction: 'BLOCK' },
        'transparency-injector': { pcsPublicListingRequired: true, annualReportPublicationRequired: true },
        'approval-queue': { reviewTier: 'T2' },
        'session-persistence': { retentionDaysMinimum: 2190 },
        'supply-chain': { fairWorkFirstFlowDownRequired: true, communityBenefitsCascadeRequired: true },
        'agent-auth': { procurementOfficerNamedRoleRequired: true },
    },
    providerPolicy: { blockedProviders: [], requiredCapabilities: ['SCOTLAND-PROCUREMENT-COMPATIBLE'], blockReasons: {} },
    dataPolicy: {
        scanCategories: ['SUSTAINABLE_PROCUREMENT_DUTY', 'COMMUNITY_BENEFITS', 'PROCUREMENT_STRATEGY_SCOTLAND', 'SPDS_DOCUMENT', 'PCS_LISTING', 'CREDENTIALS'],
        categoryActions: { SUSTAINABLE_PROCUREMENT_DUTY: 'WARN', COMMUNITY_BENEFITS: 'WARN', PROCUREMENT_STRATEGY_SCOTLAND: 'WARN', SPDS_DOCUMENT: 'WARN', PCS_LISTING: 'WARN', CREDENTIALS: 'BLOCK' },
        encryptionRequired: true, encryptionStandard: 'AES-256-GCM', minimumClassification: 'INTERNAL',
    },
    retentionPolicy: { auditLogRetentionDays: 2190, sessionRetentionDays: 2190, incidentRetentionDays: 2190, reference: 'Prescription and Limitation (Scotland) Act 1973; PR(S)A practice', forceDelete: false, requiresLegalHoldSupport: true, sovereignty: ['gb-sct', 'gb'] },
    incidentPolicy: { notificationDeadlineHours: 168, reference: 'Audit Scotland cooperation', requiredRecipients: ['scottish-procurement-service', 'audit-scotland', 'legal-counsel'], formalNotificationRequired: false },
    validators: [
        { id: 'scotland-procurement-strategy', description: 'Procurement strategy + annual report current per PR(S)A ss.15-19.', reference: 'PR(S)A 2014 ss.15-19', check: 'attestation_active', failSeverity: 'CRITICAL' },
        { id: 'scotland-procurement-sustainable-duty', description: 'Sustainable procurement duty attested for each material procurement.', reference: 'PR(S)A 2014 s.9', check: 'attestation_active', failSeverity: 'CRITICAL' },
        { id: 'scotland-procurement-community-benefits', description: 'Community benefits clause included for >£4M contracts; commitment tracked.', reference: 'PR(S)A 2014 s.25', check: 'governance_active', failSeverity: 'CRITICAL' },
        { id: 'scotland-procurement-spds', description: 'sPDS used for relevant procurements; submission archived.', reference: 'sPDS Scotland', check: 'attestation_active', failSeverity: 'HIGH' },
        { id: 'scotland-procurement-pcs-listing', description: 'PCS portal listing live for all relevant tenders.', reference: 'Public Contracts Scotland', check: 'monitoring_active', failSeverity: 'HIGH' },
        { id: 'scotland-procurement-fair-work', description: 'Fair Work First considerations + Living Wage preference captured.', reference: 'Fair Work First (Scotland)', check: 'attestation_active', failSeverity: 'HIGH' },
        { id: 'scotland-procurement-supplier-flow-down', description: 'Sub-contractor Fair Work + community-benefits flow-down recorded.', reference: 'PR(S)A sub-contractor accountability', check: 'subservice_registry_active', failSeverity: 'HIGH' },
        { id: 'scotland-procurement-evidence-audit-trail', description: 'Tamper-evident audit chain over procurement strategy + annual report + community benefits.', reference: 'PR(S)A evidence integrity', check: 'audit_trail_exists', failSeverity: 'HIGH' },
        { id: 'scotland-procurement-evidence-retention', description: '6-year retention of procurement evidence.', reference: 'Prescription and Limitation (Scotland) Act 1973', check: 'retention_policy_active', failSeverity: 'HIGH' },
        { id: 'scotland-procurement-credential-block', description: 'Plaintext credentials blocked from procurement evidence.', reference: 'Procurement evidence integrity', check: 'data_classifier_active', failSeverity: 'CRITICAL' },
    ],
};
//# sourceMappingURL=scotland-procurement-reform.js.map