---
# Shared Industry Traits - Cross-Domain Mixins
#
# Reusable traits for domain-specific ontologies.
# These extend mif-base traits with industry-agnostic patterns.
#
# Compatible with: mif-base v1.0.0 (knowledge triad hierarchy)
#
# Version: 1.0.0
# Last Updated: 2026-06-18
#
# Sources:
# - ISO 9001:2015 Quality Management Systems
# - ISO 14001:2015 Environmental Management Systems
# - NIST SP 800-53 Security Controls
# - Dublin Core Metadata Initiative (DCMI)

ontology:
  id: shared-traits
  version: "1.0.0"
  description: "Cross-domain reusable traits for industry ontologies"
  extends:
    - mif-base
# ==============================================================================
# SHARED TRAITS (MIXINS)
# ==============================================================================
# These traits can be composed into entity types across any domain.
# Each trait adds specific fields and behaviors to entities.
traits:
  # ---------------------------------------------------------------------------
  # LIFECYCLE TRAITS
  # ---------------------------------------------------------------------------
  lifecycle:
    description: "Adds lifecycle state tracking with transitions"
    fields:
      status:
        type: string
        description: "Current lifecycle state"
      status_history:
        type: array
        description: "History of status transitions"
        items:
          type: object
          properties:
            from_status:
              type: string
            to_status:
              type: string
            changed_at:
              type: string
              format: date-time
            changed_by:
              type: string
            reason:
              type: string
  renewable:
    description: "Adds renewal/expiration tracking for time-limited entities"
    fields:
      effective_date:
        type: string
        format: date
        description: "When this becomes effective"
      expiration_date:
        type: string
        format: date
        description: "When this expires"
      renewal_date:
        type: string
        format: date
        description: "When renewal is required"
      auto_renew:
        type: boolean
        description: "Whether this auto-renews"
  # ---------------------------------------------------------------------------
  # COMPLIANCE TRAITS
  # ---------------------------------------------------------------------------
  auditable:
    description: "Adds audit trail and compliance tracking"
    fields:
      audit_log:
        type: array
        description: "Audit trail entries"
        items:
          type: object
          properties:
            action:
              type: string
            actor:
              type: string
            timestamp:
              type: string
              format: date-time
            details:
              type: object
      last_audit_date:
        type: string
        format: date
      next_audit_date:
        type: string
        format: date
      audit_status:
        type: string
        enum:
          - pending
          - in_progress
          - passed
          - failed
          - requires_remediation
  certified:
    description: "Adds certification and accreditation tracking"
    fields:
      certifications:
        type: array
        description: "List of certifications held"
        items:
          type: object
          properties:
            name:
              type: string
            issuer:
              type: string
            issued_date:
              type: string
              format: date
            expiry_date:
              type: string
              format: date
            certificate_id:
              type: string
            scope:
              type: string
  regulated:
    description: "Adds regulatory compliance tracking"
    fields:
      regulations:
        type: array
        description: "Applicable regulations"
        items:
          type: object
          properties:
            name:
              type: string
            authority:
              type: string
            jurisdiction:
              type: string
            compliance_status:
              type: string
              enum:
                - compliant
                - non_compliant
                - pending_review
                - exempt
            last_verified:
              type: string
              format: date
  # ---------------------------------------------------------------------------
  # GEOGRAPHIC TRAITS
  # ---------------------------------------------------------------------------
  located:
    description: "Adds physical location data"
    fields:
      location:
        type: object
        properties:
          address:
            type: string
          city:
            type: string
          state:
            type: string
          country:
            type: string
          postal_code:
            type: string
          coordinates:
            type: object
            properties:
              latitude:
                type: number
              longitude:
                type: number
  bounded:
    description: "Adds geographic boundary/area data"
    fields:
      boundary:
        type: object
        properties:
          type:
            type: string
            enum:
              - polygon
              - circle
              - rectangle
          coordinates:
            type: array
            description: "GeoJSON-style coordinates"
          area_unit:
            type: string
            enum:
              - acres
              - hectares
              - square_meters
              - square_feet
          area_value:
            type: number
  # ---------------------------------------------------------------------------
  # STAKEHOLDER TRAITS
  # ---------------------------------------------------------------------------
  owned:
    description: "Adds ownership and responsibility tracking"
    fields:
      owner:
        type: object
        properties:
          name:
            type: string
          role:
            type: string
          contact:
            type: string
          department:
            type: string
      steward:
        type: object
        description: "Day-to-day responsible party"
        properties:
          name:
            type: string
          role:
            type: string
  contactable:
    description: "Adds contact information"
    fields:
      contacts:
        type: array
        items:
          type: object
          properties:
            name:
              type: string
            role:
              type: string
            email:
              type: string
              format: email
            phone:
              type: string
            primary:
              type: boolean
  # ---------------------------------------------------------------------------
  # FINANCIAL TRAITS
  # ---------------------------------------------------------------------------
  budgeted:
    description: "Adds budget and financial tracking"
    fields:
      budget:
        type: object
        properties:
          allocated:
            type: number
          spent:
            type: number
          remaining:
            type: number
          currency:
            type: string
          fiscal_year:
            type: string
      cost_center:
        type: string
  transactional:
    description: "Adds transaction/payment tracking"
    fields:
      transactions:
        type: array
        items:
          type: object
          properties:
            date:
              type: string
              format: date
            amount:
              type: number
            currency:
              type: string
            type:
              type: string
              enum:
                - payment
                - refund
                - credit
                - debit
            reference:
              type: string
  # ---------------------------------------------------------------------------
  # TEMPORAL TRAITS
  # ---------------------------------------------------------------------------
  scheduled:
    description: "Adds scheduling and calendar integration"
    fields:
      schedule:
        type: object
        properties:
          start_date:
            type: string
            format: date-time
          end_date:
            type: string
            format: date-time
          recurrence:
            type: string
            description: "RRULE format recurrence pattern"
          timezone:
            type: string
  seasonal:
    description: "Adds seasonal/cyclical timing"
    fields:
      season:
        type: string
        description: "Applicable season"
      cycle_start:
        type: string
        format: date
      cycle_end:
        type: string
        format: date
      cycle_type:
        type: string
        enum:
          - annual
          - quarterly
          - monthly
          - weekly
  # ---------------------------------------------------------------------------
  # MEASUREMENT TRAITS
  # ---------------------------------------------------------------------------
  measured:
    description: "Adds quantitative measurement data"
    fields:
      measurements:
        type: array
        items:
          type: object
          properties:
            metric:
              type: string
            value:
              type: number
            unit:
              type: string
            measured_at:
              type: string
              format: date-time
            measured_by:
              type: string
            method:
              type: string
  scored:
    description: "Adds scoring/rating data"
    fields:
      scores:
        type: array
        items:
          type: object
          properties:
            category:
              type: string
            score:
              type: number
            max_score:
              type: number
            scored_at:
              type: string
              format: date
            scorer:
              type: string
  # ---------------------------------------------------------------------------
  # CLASSIFICATION TRAITS
  # ---------------------------------------------------------------------------
  categorized:
    description: "Adds hierarchical categorization"
    fields:
      category:
        type: string
        description: "Primary category"
      subcategory:
        type: string
        description: "Secondary category"
      taxonomy:
        type: array
        description: "Full taxonomy path"
        items:
          type: string
  tagged:
    description: "Adds flexible tagging"
    fields:
      tags:
        type: array
        items:
          type: string
      labels:
        type: object
        description: "Key-value labels"
  # ---------------------------------------------------------------------------
  # ASSET TRAITS
  # ---------------------------------------------------------------------------
  inventoried:
    description: "Adds inventory tracking"
    fields:
      inventory_id:
        type: string
      serial_number:
        type: string
      quantity:
        type: number
      unit:
        type: string
      location_code:
        type: string
      last_inventory_date:
        type: string
        format: date
  maintainable:
    description: "Adds maintenance scheduling"
    fields:
      maintenance_schedule:
        type: string
        description: "Maintenance frequency"
      last_maintenance:
        type: string
        format: date
      next_maintenance:
        type: string
        format: date
      maintenance_log:
        type: array
        items:
          type: object
          properties:
            date:
              type: string
              format: date
            type:
              type: string
            technician:
              type: string
            notes:
              type: string
            cost:
              type: number
  # ---------------------------------------------------------------------------
  # QUALITY TRAITS
  # ---------------------------------------------------------------------------
  reviewed:
    description: "Adds review/approval workflow"
    fields:
      review_status:
        type: string
        enum:
          - draft
          - pending_review
          - in_review
          - approved
          - rejected
          - revision_required
      reviewer:
        type: string
      review_date:
        type: string
        format: date
      review_notes:
        type: string
      approval_chain:
        type: array
        items:
          type: object
          properties:
            role:
              type: string
            approver:
              type: string
            status:
              type: string
            date:
              type: string
              format: date-time
  quality_controlled:
    description: "Adds quality control checkpoints"
    fields:
      qc_status:
        type: string
        enum:
          - not_started
          - in_progress
          - passed
          - failed
          - waived
      qc_checkpoints:
        type: array
        items:
          type: object
          properties:
            checkpoint:
              type: string
            status:
              type: string
            checked_by:
              type: string
            checked_at:
              type: string
              format: date-time
            issues:
              type: array
              items:
                type: string
  # ---------------------------------------------------------------------------
  # PROVENANCE / METADATA TRAITS
  # Promoted here so domain packs that extend [mif-base, shared-traits] carry the
  # generic provenance traits the ontology build-spec assigns. Definitions match
  # engineering-base (cited/dated/versioned/documented) and the software-engineering
  # pack (timeline/stakeholders) verbatim, so a trait name means the same thing
  # everywhere it resolves.
  # ---------------------------------------------------------------------------
  cited:
    description: "Requires citations/sources"
    requires:
      - citations
  dated:
    description: "Adds decision/event date"
    fields:
      decision_date:
        type: string
        format: date
      review_date:
        type: string
        format: date
  versioned:
    description: "Adds version tracking fields"
    fields:
      version:
        type: string
        pattern: "^\\d+\\.\\d+\\.\\d+.*$"
      changelog:
        type: array
        items:
          type: object
  documented:
    description: "Adds documentation reference"
    fields:
      documentation_url:
        type: string
        format: uri
      readme_path:
        type: string
  timeline:
    description: "Adds an event timeline"
    fields:
      timeline:
        type: array
        items:
          type: object
          properties:
            timestamp:
              type: string
              format: date-time
            event:
              type: string
            actor:
              type: string
  stakeholders:
    description: "Adds stakeholder tracking"
    fields:
      stakeholders:
        type: array
        items:
          type: object
          properties:
            name:
              type: string
            role:
              type: string
            contact:
              type: string
  attributed:
    description: "Adds attribution to an agent or source"
    fields:
      attributed_to:
        type: array
        items:
          type: string
