id: "a3-risks-techdebt-health-profile"
version: "1.0.0"
name: "Risks, Tech Debt & Health"
description: "Modeling profile for risks, technical debt, and quality - Everything that creates risks or reduces quality"
icon: "Warning"

# Note: Model elements and relationships already have a default 'description' field.
# Do not create duplicate description properties in property groups.

# Status Enumerations
statusEnumerations:
  - id: "a3.risk-lifecycle"
    name: "Risk Lifecycle"
    description: "Lifecycle status for risks"
    descriptionDetailed: "Status enumeration for the various phases in the lifecycle of a risk from identification to resolution or acceptance."
    default: "identified"
    values:
      - key: "identified"
        displayName: "Identified"
        description: "Risk has been identified but not yet assessed"
        descriptionDetailed: "The risk has been recognized and documented, but has not yet been assessed regarding its impact or probability."
        category: "active"
        order: 1
      - key: "assessed"
        displayName: "Assessed"
        description: "Risk has been assessed and prioritized"
        descriptionDetailed: "The risk has been assessed regarding its impact, probability, and priority."
        category: "active"
        order: 2
      - key: "mitigated"
        displayName: "Mitigated"
        description: "Risk has been reduced through measures"
        descriptionDetailed: "Measures have been taken to reduce or control the risk."
        category: "active"
        order: 3
      - key: "accepted"
        displayName: "Accepted"
        description: "Risk has been consciously accepted"
        descriptionDetailed: "The risk has been consciously accepted because the costs of remediation are higher than the expected damage."
        category: "active"
        order: 4
      - key: "resolved"
        displayName: "Resolved"
        description: "Risk has been fully resolved"
        descriptionDetailed: "The risk has been completely eliminated or resolved and no longer poses a threat."
        category: "deactive"
        order: 5
      - key: "obsolete"
        displayName: "Obsolete"
        description: "Risk is no longer relevant"
        descriptionDetailed: "The risk is no longer relevant due to changes in the system or environment."
        category: "deactive"
        order: 6

  - id: "a3.techdebt-lifecycle"
    name: "Tech Debt Lifecycle"
    description: "Lifecycle status for technical debt"
    descriptionDetailed: "Status enumeration for the various phases in the lifecycle of technical debt from incurrence to repayment."
    default: "incurred"
    values:
      - key: "incurred"
        displayName: "Incurred"
        description: "Technical debt has been consciously incurred"
        descriptionDetailed: "The technical debt has been consciously incurred, e.g., to save time or to deliver faster."
        category: "active"
        order: 1
      - key: "documented"
        displayName: "Documented"
        description: "Technical debt has been documented and described"
        descriptionDetailed: "The technical debt has been documented, described, and possibly prioritized."
        category: "active"
        order: 2
      - key: "planned"
        displayName: "Planned"
        description: "Repayment of technical debt is planned"
        descriptionDetailed: "The repayment of technical debt has been planned and is included in the backlog or roadmap."
        category: "active"
        order: 3
      - key: "in-progress"
        displayName: "In Progress"
        description: "Repayment of technical debt is in progress"
        descriptionDetailed: "The technical debt is currently being repaid or refactored."
        category: "active"
        order: 4
      - key: "repaid"
        displayName: "Repaid"
        description: "Technical debt has been fully repaid"
        descriptionDetailed: "The technical debt has been fully repaid and the system has been improved accordingly."
        category: "deactive"
        order: 5
      - key: "written-off"
        displayName: "Written Off"
        description: "Technical debt has been written off (no longer relevant)"
        descriptionDetailed: "The technical debt has been written off because it is no longer relevant due to changes or the affected system no longer exists."
        category: "deactive"
        order: 6

# Element Types
elementTypes:
  - id: "a3.risk"
    name: "Risk"
    description: "A risk that encompasses architecture, security, performance, or integration risks"
    descriptionDetailed: "A Risk element represents an identified risk in the system or architecture. Risks can encompass various categories: architecture risks (e.g., missing scalability), security risks (e.g., vulnerabilities), performance risks (e.g., bottlenecks), or integration risks (e.g., dependencies on external systems). Risks should be linked to affected elements to document their impact."
    baseType: "default-model-element"
    layer: "business"
    statusEnumeration: "a3.risk-lifecycle"
    organizationalRoles: ["watcher", "owner", "stakeholder"]
    propertiesSchema:
      - "a3-risk-common"
      - "a3-risk-assessment"
    style:
      icon: "WarningAlt"
      accentColor: "#da1e28"
      defaultCanvasStyle: "card"
      shape: "<svg id='icon' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><path d='M16,23a1.5,1.5,0,1,0,1.5,1.5A1.5,1.5,0,0,0,16,23Z'/><rect x='15' y='12' width='2' height='9'/><path d='M29,30H3a1,1,0,0,1-.8872-1.4614l13-25a1,1,0,0,1,1.7744,0l13,25A1,1,0,0,1,29,30ZM4.6507,28H27.3493l.002-.0033L16.002,6.1714h-.004L4.6487,27.9967Z'/></svg>"

  - id: "a3.tech-debt-item"
    name: "Tech Debt Item"
    description: "A consciously incurred technical debt"
    descriptionDetailed: "A Tech Debt Item represents a consciously incurred technical debt. Technical debt occurs when short-term solutions are deliberately chosen to save time or deliver faster, with the knowledge that refactoring will be needed later. Tech Debt Items should be linked to affected systems, containers, or components to document their impact."
    baseType: "default-model-element"
    layer: "application"
    statusEnumeration: "a3.techdebt-lifecycle"
    organizationalRoles: ["watcher", "owner", "developer"]
    propertiesSchema:
      - "a3-techdebt-common"
      - "a3-techdebt-impact"
    style:
      icon: "Purchase"
      accentColor: "#ba4e00"
      defaultCanvasStyle: "card"

# Relationship Types
relationshipTypes:
  - id: "a3.affects"
    name: "affects"
    description: "Indicates that a risk or technical debt affects an element"
    descriptionDetailed: "An Affects relationship indicates that a Risk or Tech Debt Item affects a specific element (System, Container, Component, etc.). This relationship documents which elements are affected by a risk or technical debt and helps understand the impact."
    typeMappings:
      - sourceElementTypes: ["a3.risk", "a3.tech-debt-item"]
        targetElementTypes: ["*"]
    bidirectional: false
    relationshipType: "default"
    prefillLabel: false
    reverse:
      name: "affected by"
      description: "Elements that are affected by this risk or technical debt"
      descriptionDetailed: "The reverse of the 'Affects' relationship. When a risk affects a system, the system is 'affected by' the risk."
    propertiesSchema:
      details: "a3-affects-details"
    style:
      style: "dashed"
      startArrow: "none"
      endArrow: "arrow"
      defaultColor: "#000000"
      thickness: 1

  - id: "a3.mitigates"
    name: "mitigates"
    description: "Indicates that an element reduces or mitigates a risk"
    descriptionDetailed: "A Mitigates relationship indicates that an element (e.g., a measure, a system, a component) reduces, mitigates, or controls a risk. This relationship documents risk mitigation measures."
    typeMappings:
      - sourceElementTypes: ["*"]
        targetElementTypes: ["a3.risk"]
    bidirectional: false
    relationshipType: "default"
    prefillLabel: false
    style:
      style: "line"
      startArrow: "none"
      endArrow: "arrow"
      defaultColor: "#000000"
      thickness: 1

  - id: "a3.causes"
    name: "causes"
    description: "Indicates that an element causes a risk or creates technical debt"
    descriptionDetailed: "A Causes relationship indicates that an element (e.g., an architectural decision, a system, a component) causes a risk or creates technical debt. This relationship documents the causes of risks and technical debt."
    typeMappings:
      - sourceElementTypes: ["*"]
        targetElementTypes: ["a3.risk", "a3.tech-debt-item"]
    bidirectional: false
    relationshipType: "default"
    prefillLabel: false
    style:
      style: "line"
      startArrow: "none"
      endArrow: "arrow"
      defaultColor: "#000000"
      thickness: 1

  - id: "a3.related-to"
    name: "related to"
    description: "Indicates a general relationship between risks or technical debt"
    descriptionDetailed: "A Related To relationship indicates a general relationship between risks or technical debt. This relationship can be used to document connections between different risks or technical debt."
    typeMappings:
      - sourceElementTypes: ["a3.risk", "a3.tech-debt-item"]
        targetElementTypes: ["a3.risk", "a3.tech-debt-item"]
    bidirectional: true
    relationshipType: "default"
    prefillLabel: false
    style:
      style: "dashed"
      startArrow: "none"
      endArrow: "none"
      defaultColor: "#000000"
      thickness: 1

# Property Groups
propertyGroups:
  - id: "a3-risk-common"
    name: "Risk Common Properties"
    description: "Common properties for risks"
    descriptionDetailed: "This property group contains common properties for Risk elements, including the risk category."
    properties:
      - fieldName: "risk-category"
        displayName: "Risk Category"
        description: "The category of the risk (Architecture, Security, Performance, Integration)"
        descriptionDetailed: "The category classifies the risk by its type. Architecture risks affect structural aspects, security risks affect security aspects, performance risks affect performance aspects, and integration risks affect dependencies and integrations."
        type: "selection"
        required: true
        defaultValue: "architecture"
        options:
          - key: "architecture"
            displayName: "Architecture"
            description: "Architecture risk - affects structural aspects of the system"
          - key: "security"
            displayName: "Security"
            description: "Security risk - affects security aspects"
          - key: "performance"
            displayName: "Performance"
            description: "Performance risk - affects performance aspects"
          - key: "integration"
            displayName: "Integration"
            description: "Integration risk - affects dependencies and integrations"
          - key: "other"
            displayName: "Other"
            description: "Other risk category"

  - id: "a3-risk-assessment"
    name: "Risk Assessment"
    description: "Assessment properties for risks"
    descriptionDetailed: "This property group contains properties for assessing risks, including probability, impact, and priority."
    properties:
      - fieldName: "risk-probability"
        displayName: "Probability"
        description: "The probability that the risk will occur"
        descriptionDetailed: "The estimated probability that the risk will actually occur. This helps prioritize risks."
        type: "selection"
        required: false
        defaultValue: "medium"
        options:
          - key: "very-low"
            displayName: "Very Low"
            description: "Very unlikely (< 10%)"
          - key: "low"
            displayName: "Low"
            description: "Unlikely (10-30%)"
          - key: "medium"
            displayName: "Medium"
            description: "Possible (30-60%)"
          - key: "high"
            displayName: "High"
            description: "Likely (60-80%)"
          - key: "very-high"
            displayName: "Very High"
            description: "Very likely (> 80%)"
      - fieldName: "risk-impact"
        displayName: "Impact"
        description: "The estimated impact if the risk occurs"
        descriptionDetailed: "The estimated impact or damage that would occur if the risk materializes. This helps prioritize risks."
        type: "selection"
        required: false
        defaultValue: "medium"
        options:
          - key: "very-low"
            displayName: "Very Low"
            description: "Minimal impact - barely noticeable"
          - key: "low"
            displayName: "Low"
            description: "Low impact - minor problems"
          - key: "medium"
            displayName: "Medium"
            description: "Moderate impact - noticeable problems"
          - key: "high"
            displayName: "High"
            description: "High impact - significant problems"
          - key: "very-high"
            displayName: "Very High"
            description: "Critical impact - system failure or serious problems"
      - fieldName: "risk-priority"
        displayName: "Priority"
        description: "The priority of the risk based on probability and impact"
        descriptionDetailed: "The calculated or manually set priority of the risk. This is typically derived from probability and impact."
        type: "selection"
        required: false
        defaultValue: "medium"
        options:
          - key: "very-low"
            displayName: "Very Low"
            description: "Very low priority"
          - key: "low"
            displayName: "Low"
            description: "Low priority"
          - key: "medium"
            displayName: "Medium"
            description: "Medium priority"
          - key: "high"
            displayName: "High"
            description: "High priority"
          - key: "very-high"
            displayName: "Very High"
            description: "Very high priority - immediate attention required"

  - id: "a3-techdebt-common"
    name: "Tech Debt Common Properties"
    description: "Common properties for technical debt"
    descriptionDetailed: "This property group contains common properties for Tech Debt Item elements, including the category and reason."
    properties:
      - fieldName: "techdebt-category"
        displayName: "Category"
        description: "The category of the technical debt"
        descriptionDetailed: "The category classifies the technical debt by its type. This helps organize and prioritize technical debt."
        type: "selection"
        required: false
        defaultValue: "code"
        options:
          - key: "code"
            displayName: "Code"
            description: "Code-related technical debt (e.g., code duplication, poor naming)"
          - key: "architecture"
            displayName: "Architecture"
            description: "Architecture-related technical debt (e.g., missing abstractions, poor structuring)"
          - key: "dependencies"
            displayName: "Dependencies"
            description: "Dependency-related technical debt (e.g., outdated libraries, missing updates)"
          - key: "documentation"
            displayName: "Documentation"
            description: "Documentation-related technical debt (e.g., missing or outdated documentation)"
          - key: "testing"
            displayName: "Testing"
            description: "Testing-related technical debt (e.g., missing tests, low test coverage)"
          - key: "infrastructure"
            displayName: "Infrastructure"
            description: "Infrastructure-related technical debt (e.g., outdated tools, manual processes)"
          - key: "other"
            displayName: "Other"
            description: "Other category of technical debt"
      - fieldName: "techdebt-reason"
        displayName: "Reason"
        description: "The reason why the technical debt was incurred"
        descriptionDetailed: "The original reason why the technical debt was consciously incurred (e.g., time pressure, lack of resources, fast delivery)."
        type: "text"
        required: false

  - id: "a3-techdebt-impact"
    name: "Tech Debt Impact"
    description: "Impact properties for technical debt"
    descriptionDetailed: "This property group contains properties for assessing the impact of technical debt, including estimated costs and effort for repayment."
    properties:
      - fieldName: "techdebt-effort"
        displayName: "Estimated Effort"
        description: "The estimated effort to repay the technical debt"
        descriptionDetailed: "An estimate of the effort (e.g., in person-days or story points) required to repay the technical debt."
        type: "selection"
        required: false
        defaultValue: "medium"
        options:
          - key: "very-low"
            displayName: "Very Low"
            description: "Very low effort (< 1 day)"
          - key: "low"
            displayName: "Low"
            description: "Low effort (1-3 days)"
          - key: "medium"
            displayName: "Medium"
            description: "Medium effort (3-10 days)"
          - key: "high"
            displayName: "High"
            description: "High effort (10-30 days)"
          - key: "very-high"
            displayName: "Very High"
            description: "Very high effort (> 30 days)"
      - fieldName: "techdebt-impact-level"
        displayName: "Impact"
        description: "The current impact of the technical debt on the system"
        descriptionDetailed: "An assessment of the current impact of the technical debt on the system, development, or maintainability."
        type: "selection"
        required: false
        defaultValue: "medium"
        options:
          - key: "very-low"
            displayName: "Very Low"
            description: "Minimal impact - barely noticeable"
          - key: "low"
            displayName: "Low"
            description: "Low impact - minor problems"
          - key: "medium"
            displayName: "Medium"
            description: "Moderate impact - noticeable problems"
          - key: "high"
            displayName: "High"
            description: "High impact - significant problems"
          - key: "very-high"
            displayName: "Very High"
            description: "Critical impact - blocks development or causes frequent problems"
      - fieldName: "techdebt-priority"
        displayName: "Priority"
        description: "The priority for repaying the technical debt"
        descriptionDetailed: "The priority with which the technical debt should be repaid, based on impact and effort."
        type: "selection"
        required: false
        defaultValue: "medium"
        options:
          - key: "very-low"
            displayName: "Very Low"
            description: "Very low priority"
          - key: "low"
            displayName: "Low"
            description: "Low priority"
          - key: "medium"
            displayName: "Medium"
            description: "Medium priority"
          - key: "high"
            displayName: "High"
            description: "High priority"
          - key: "very-high"
            displayName: "Very High"
            description: "Very high priority - should be repaid soon"

  - id: "a3-affects-details"
    name: "Affects Relationship Details"
    description: "Details for Affects relationships"
    descriptionDetailed: "This property group contains additional details for Affects relationships between risks/technical debt and affected elements."
    properties:
      - fieldName: "affects-severity"
        displayName: "Severity"
        description: "The severity with which the risk or technical debt affects the element"
        descriptionDetailed: "An assessment of how strongly the element is affected by the risk or technical debt."
        type: "selection"
        required: false
        defaultValue: "medium"
        options:
          - key: "very-low"
            displayName: "Very Low"
            description: "Minimal impairment"
          - key: "low"
            displayName: "Low"
            description: "Low impairment"
          - key: "medium"
            displayName: "Medium"
            description: "Moderate impairment"
          - key: "high"
            displayName: "High"
            description: "High impairment"
          - key: "very-high"
            displayName: "Very High"
            description: "Critical impairment"


# Validations
validations:
  - id: "a3-risk-should-have-category"
    name: "Risk Should Have Category"
    description: "Risks should specify a risk category"
    severity: "warning"
    scope:
      elementTypes: ["a3.risk"]
    validation: "element.properties.common != null && element.properties.common['risk-category'] != null && element.properties.common['risk-category'] != ''"
    message: "Risk '{{element.properties.name}}' should specify a risk category"
    suggestion: "Add a risk category to the Risk element (Architecture, Security, Performance, Integration)"

  - id: "a3-risk-should-have-assessment"
    name: "Risk Should Have Assessment"
    description: "Risks should be assessed (probability and impact)"
    severity: "info"
    scope:
      elementTypes: ["a3.risk"]
    validation: "element.properties.assessment != null && element.properties.assessment['risk-probability'] != null && element.properties.assessment['risk-impact'] != null"
    message: "Risk '{{element.properties.name}}' could be assessed (probability and impact)"
    suggestion: "Add an assessment to the Risk element to determine priority"

  - id: "a3-risk-should-affect-elements"
    name: "Risk Should Affect Elements"
    description: "Risks should be linked to affected elements"
    severity: "info"
    scope:
      elementTypes: ["a3.risk"]
    validation: "element.relationships[type == 'a3.affects'].count() > 0"
    message: "Risk '{{element.properties.name}}' could be linked to affected elements"
    suggestion: "Add 'Affects' relationships to document which elements are affected by this risk"

  - id: "a3-techdebt-should-have-description"
    name: "Tech Debt Should Have Description"
    description: "Technical debt should have a description"
    severity: "warning"
    scope:
      elementTypes: ["a3.tech-debt-item"]
    validation: "element.description != null && element.description != ''"
    message: "Tech Debt Item '{{element.properties.name}}' should have a description"
    suggestion: "Add a description explaining what the technical debt is and why it was incurred"

  - id: "a3-techdebt-should-affect-elements"
    name: "Tech Debt Should Affect Elements"
    description: "Technical debt should be linked to affected elements"
    severity: "info"
    scope:
      elementTypes: ["a3.tech-debt-item"]
    validation: "element.relationships[type == 'a3.affects'].count() > 0"
    message: "Tech Debt Item '{{element.properties.name}}' could be linked to affected elements"
    suggestion: "Add 'Affects' relationships to document which elements are affected by this technical debt"

# Metadata
metadata:
  tags:
    - "risks"
    - "tech-debt"
    - "quality"
    - "health"
    - "architecture"
  source: "Internal"
