id: "c4-profile"
version: "1.0.0"
name: "C4 Model"
description: "C4 Model profile for software architecture visualization at multiple levels of abstraction"
icon: "Application"

# Status Enumerations
statusEnumerations:
  - id: "c4.default-lifecycle"
    name: "Standard Lifecycle"
    description: "Standard lifecycle status for architectural elements"
    descriptionDetailed: "Use this enumeration for elements that follow a typical lifecycle from conception to retirement. This enumeration covers the full spectrum from initial planning through active use to eventual decommissioning."
    default: "draft"
    values:
      - key: "new"
        displayName: "New"
        description: "Element has been created (as a potentially required element) but not yet reviewed (candidate)"
        descriptionDetailed: "The element exists but has not been validated or approved. Use this status for newly created elements that are still being defined."
        category: "proposed"
        order: 1
      - key: "draft"
        displayName: "Draft"
        description: "Element has been confirmed as required in the solutions scope and is being drafted and refined"
        descriptionDetailed: "The element is in active development or review. Use this status when the element's definition is being refined or is awaiting approval."
        category: "proposed"
        order: 2
      - key: "confirmed"
        displayName: "Confirmed"
        description: "Element has been confirmed and is active"
        descriptionDetailed: "The element has been validated and is in active use. Use this status when the element is ready for use and has been approved."
        category: "active"
        order: 3
      - key: "in-production"
        displayName: "In Production"
        description: "Element is actively deployed and operational"
        descriptionDetailed: "The element is live and serving its intended purpose. Use this status when the element is actively being used in production environments."
        category: "active"
        order: 4
      - key: "deprecated"
        displayName: "Deprecated"
        description: "Element is still active but marked for removal"
        descriptionDetailed: "The element is still operational but should not be used for new work. Use this status when planning to retire an element but it is still in use."
        category: "active"
        order: 5
      - key: "decommissioned"
        displayName: "Decommissioned"
        description: "Element has been removed from service"
        descriptionDetailed: "The element is no longer operational and has been removed. Use this status when an element has been fully retired and is no longer in use."
        category: "deactive"
        order: 6

# Element Types
elementTypes:
  # Structural Element Types:
  - id: "c4.person"
    name: "Person"
    description: "A person who uses the software system"
    descriptionDetailed: "A Person represents a human user of the software system. Persons are external actors who interact with the system. They appear in System Context diagrams and represent the users or stakeholders of the system. Do not confuse with System or Container - Persons are always external to the software system."
    baseType: "default-model-element"
    layer: "business"
    statusEnumeration: "c4.default-lifecycle"
    organizationalRoles: ["watcher", "owner"]
    descriptionTextTemplate: ["c4-person-description"]
    propertiesSchema:
      - "c4-element-common"
    style:
      icon: "User"
      accentColor: "#d02670"
      defaultCanvasStyle: "shape"

  - id: "c4.system"
    name: "System"
    description: "A software system that delivers value to its users"
    descriptionDetailed: "A System represents a software system that provides value to its users. Systems are the highest-level containers in C4 and appear in System Context diagrams. A system is a collection of containers that work together to deliver value. Do not confuse with Container (which is inside a System) or Component (which is inside a Container)."
    baseType: "default-model-element"
    layer: "application"
    statusEnumeration: "c4.default-lifecycle"
    organizationalRoles: ["watcher", "domain-expert", "owner"]
    propertiesSchema:
      - "c4-element-common"
    style:
      icon: "ContainerServices"
      accentColor: "#198038"
      defaultCanvasStyle: "card"

  - id: "c4.container"
    name: "Container"
    description: "A deployable unit within a system that can run independently"
    descriptionDetailed: "A Container represents a deployable unit within a System that can run independently. Containers are applications, databases, or other deployable components. Examples include web applications, mobile apps, databases, file systems, or message queues. Containers appear in Container diagrams and are the building blocks of Systems. Do not confuse with System (which contains Containers) or Component (which is inside a Container)."
    baseType: "default-model-element"
    layer: "application"
    statusEnumeration: "c4.default-lifecycle"
    organizationalRoles: ["watcher", "domain-expert", "owner"]
    propertiesSchema:
      - "c4-element-common"
      - "c4-container-deployment"
    style:
      icon: "Box"
      accentColor: "#0072c3"
      defaultCanvasStyle: "card"

  - id: "c4.database"
    name: "Database"
    description: "A database or data store used by containers"
    descriptionDetailed: "A Database represents a data store or database used by Containers. Databases can be relational databases, NoSQL databases, file systems, or any other persistent storage mechanism. Databases appear in Container diagrams and represent where data is stored. Do not confuse with Container (which uses Databases) - Databases are a special type of Connector that stores data."
    baseType: "default-model-element"
    layer: "data"
    statusEnumeration: "c4.default-lifecycle"
    organizationalRoles: ["watcher", "domain-expert", "owner"]
    propertiesSchema:
      - "c4-element-common"
      - "c4-database-details"
    style:
      icon: "Db2Database"
      accentColor: "#da1e28"
      defaultCanvasStyle: "card"

  - id: "c4.component"
    name: "Component"
    description: "A component within a container that groups related functionality"
    descriptionDetailed: "A Component represents a grouping of related functionality within a Container. Components are the building blocks of Containers and appear in Component diagrams. A component typically represents a module, class, or set of classes that work together. Do not confuse with Container (which contains Components) or System (which contains Containers)."
    baseType: "default-model-element"
    layer: "application"
    statusEnumeration: "c4.default-lifecycle"
    organizationalRoles: ["watcher", "domain-expert", "owner"]
    propertiesSchema:
      - "c4-element-common"
    style:
      icon: "Cube"
      accentColor: "#007d79"
      defaultCanvasStyle: "card"

  - id: "c4.infrastructure-node"
    name: "Infrastructure Node"
    description: "A physical or virtual infrastructure node that hosts containers and other infrastructure nodes"
    descriptionDetailed: "An Infrastructure Node represents a physical or virtual infrastructure component such as a physical server, virtual machine, cloud instance, container orchestration platform, or network device. Infrastructure nodes can contain containers and can also be nested (e.g., a Docker container running on a VM, which runs on a physical server). Infrastructure nodes form the foundation of deployment diagrams."
    baseType: "default-model-element"
    layer: "technology"
    statusEnumeration: "c4.default-lifecycle"
    organizationalRoles: ["watcher", "domain-expert", "owner"]
    propertiesSchema:
      - "c4-element-common"
      - "c4-infrastructure-details"
    style:
      icon: "BareMetalServer"
      accentColor: "#8a3ffc"
      defaultCanvasStyle: "card"

  - id: "c4.deployment-node"
    name: "Deployment Node"
    description: "An infrastructure node that hosts containers and other deployment nodes"
    descriptionDetailed: "A Deployment Node represents an infrastructure node such as a physical server, virtual machine, cloud instance, or container orchestration platform. Deployment nodes can contain containers and can also be nested (e.g. a Docker container running on a VM, which runs on a physical server). Deployment diagrams show how containers are deployed onto infrastructure nodes."
    baseType: "default-model-element"
    layer: "technology"
    statusEnumeration: "c4.default-lifecycle"
    organizationalRoles: ["watcher", "domain-expert", "owner"]
    propertiesSchema:
      - "c4-element-common"
      - "c4-infrastructure-details"
    style:
      icon: "Deploy"
      accentColor: "#8a3ffc"
      defaultCanvasStyle: "card"

  - id: "c4.environment"
    name: "Environment"
    description: "A deployment environment that groups infrastructure nodes and containers"
    descriptionDetailed: "An Environment represents a deployment environment such as Development, Staging, Production, Testing, or QA. Environments group infrastructure nodes and containers to represent where software is deployed and runs. Environments help organize deployment diagrams by showing which containers and infrastructure nodes belong to which deployment environment. Environments can contain infrastructure nodes, containers, and other environments (for nested environments like Production-US and Production-EU)."
    baseType: "default-model-element"
    layer: "organization"
    statusEnumeration: "c4.default-lifecycle"
    organizationalRoles: ["watcher", "domain-expert", "owner"]
    propertiesSchema:
      - "c4-element-common"
    style:
      icon: "Cloud"
      accentColor: "#ba4e00"
      defaultCanvasStyle: "card"

  # Diagram Types:
  - id: "c4.system-context-diagram"
    name: "C4 System Context Diagram (Level 1)"
    description: "High-level view showing the system and its users"
    descriptionDetailed: "A System Context diagram provides the highest level of abstraction, showing the system as a box in the center, surrounded by its users and the other systems that it interacts with. This diagram is useful for understanding the system's scope and its relationships with external actors and systems."
    baseType: "diagram"
    layer: "application"
    canvasConfig:
      allowedElementTypes: ["*"]
      description: "System Context diagrams show the system and its users. Only Person and System elements can be placed on this diagram."
      descriptionDetailed: "System Context diagrams are the highest level of C4 abstraction. They show a system in the center surrounded by its users (Persons) and other systems it interacts with. Only Person and System element types should be placed on System Context diagrams, as they represent the external actors and the system boundary."
    style:
      icon: "Diagram"
      accentColor: "#198038"
      defaultCanvasStyle: "card"

  - id: "c4.container-diagram"
    name: "C4 Container Diagram (Level 2)"
    description: "Shows the containers within a system and their relationships"
    descriptionDetailed: "A Container diagram zooms into a System, showing the high-level technical building blocks (containers) that make up the system. Containers are deployable units like web applications, databases, or file systems. This diagram shows how containers interact with each other and with external systems."
    baseType: "diagram"
    layer: "application"
    canvasConfig:
      allowedElementTypes: ["*"]
      description: "Container diagrams show the containers within a system. Person, System, Container, and Database elements can be placed on this diagram."
      descriptionDetailed: "Container diagrams zoom into a System to show its high-level technical building blocks. They display containers (deployable units), databases, and how they interact with external systems and users. Person, System, Container, and Database element types are appropriate for Container diagrams."
    style:
      icon: "Diagram"
      accentColor: "#0072c3"
      defaultCanvasStyle: "card"

  - id: "c4.component-diagram"
    name: "C4 Component Diagram (Level 3)"
    description: "Shows the components within a container and their relationships"
    descriptionDetailed: "A Component diagram zooms into a Container, showing the components (modules, classes, or groups of classes) that make up the container. This diagram shows how components interact with each other and with external containers or databases. This is the most detailed level of the C4 model."
    baseType: "diagram"
    layer: "application"
    canvasConfig:
      allowedElementTypes: ["*"]
      description: "Component diagrams show the components within a container. Container, Component, and Database elements can be placed on this diagram."
      descriptionDetailed: "Component diagrams zoom into a Container to show its internal components (modules, classes, or groups of classes). They display how components interact with each other and with external containers or databases. Container, Component, and Database element types are appropriate for Component diagrams."
    style:
      icon: "Diagram"
      accentColor: "#007d79"
      defaultCanvasStyle: "card"

  - id: "c4.deployment-diagram"
    name: "C4 Deployment Diagram"
    description: "Shows how containers are deployed onto infrastructure nodes within environments"
    descriptionDetailed: "A Deployment diagram shows the deployment topology of containers onto infrastructure nodes (servers, VMs, cloud instances, etc.) within deployment environments. This diagram illustrates where containers run in the infrastructure, including nested infrastructure nodes (e.g., Docker containers on VMs on physical servers) and how they are organized by environment (Development, Staging, Production). Deployment diagrams help understand infrastructure requirements, scalability, and deployment strategies."
    baseType: "diagram"
    layer: "technology"
    canvasConfig:
      allowedElementTypes: ["c4.container", "c4.database", "c4.infrastructure-node", "c4.deployment-node", "c4.environment", "system.*", "basic-shapes.*", "collaboration.*", "a3.*"]
      description: "Deployment diagrams show how containers are deployed onto infrastructure. Container, Database, Infrastructure Node, Deployment Node, and Environment elements can be placed on this diagram."
      descriptionDetailed: "Deployment diagrams show the deployment topology of containers onto infrastructure nodes. They illustrate where containers run in the infrastructure, including nested infrastructure nodes and how they are organized by environment. Container, Database, Infrastructure Node, Deployment Node, and Environment element types are appropriate for Deployment diagrams."
    style:
      icon: "Diagram"
      accentColor: "#8a3ffc"
      defaultCanvasStyle: "card"


# Relationship Types
relationshipTypes:
  - id: "c4.uses"
    name: "uses"
    description: "Indicates that one element uses another"
    descriptionDetailed: "A Uses relationship represents a dependency where one element requires or utilizes another element to fulfill its purpose. The source element depends on the target element's functionality or services. This is the most common relationship type in C4 diagrams. For example, a Container uses a Database, or a Person uses a System."
    typeMappings:
      - sourceElementTypes: ["c4.person", "c4.system", "c4.container", "c4.component"]
        targetElementTypes: ["c4.system", "c4.container", "c4.component", "c4.database"]
    bidirectional: false
    relationshipType: "default"
    prefillLabel: false
    reverse:
      name: "used by"
      description: "Elements that use this element"
      descriptionDetailed: "The reverse of the 'Uses' relationship. When a container uses a database, the database is 'used by' the container. This represents the inverse perspective of the dependency relationship."
    propertiesSchema:
      details: "c4-uses-details"
    style:
      style: "line"
      startArrow: "none"
      endArrow: "arrow_filled"
      defaultColor: "#6f6f6f"
      thickness: 1

  - id: "c4.deployed-on.contains"
    name: "hosts"
    description: "Indicates that an infrastructure or deployment node hosts containers or other infrastructure nodes"
    descriptionDetailed: "A Hosts relationship represents that an infrastructure node or deployment node hosts containers, databases, or other infrastructure nodes. This relationship shows the deployment topology - which infrastructure nodes host which containers. Infrastructure nodes can be nested, so a Docker container might host an application container, which is hosted by a VM, which is hosted by a physical server. The source (outer element) always represents the hosting infrastructure node, and the target (inner element) represents what is hosted."
    typeMappings:
      - sourceElementTypes: ["c4.infrastructure-node", "c4.deployment-node"]
        targetElementTypes: ["c4.container", "c4.database", "c4.deployment-node", "c4.infrastructure-node"]
    bidirectional: false
    relationshipType: "aggregation"
    prefillLabel: false
    reverse:
      name: "deployed on"
      description: "Elements that are deployed on this infrastructure node"
      descriptionDetailed: "The reverse of the 'Hosts' relationship. When an infrastructure node hosts a container, the container is 'deployed on' the infrastructure node. This represents the deployment perspective from the container's point of view."
    style:
      style: "bold"
      startArrow: "none"
      endArrow: "arrow_filled"
      defaultColor: "#6f6f6f"
      thickness: 1

  - id: "c4.contains"
    name: "contains"
    description: "Indicates that an element is contained within an environment"
    descriptionDetailed: "A Contains relationship represents that a deployment environment contains another element. This relationship shows which elements belong to which environment (e.g., Development, Staging, Production). Environments can contain infrastructure nodes, containers, databases, and even other environments for nested environment scenarios."
    typeMappings:
      - sourceElementTypes: ["c4.environment"]
        targetElementTypes: ["c4.container", "c4.database", "c4.infrastructure-node", "c4.deployment-node", "c4.environment"]
      - sourceElementTypes: ["c4.system"]
        targetElementTypes: ["c4.container"]
      - sourceElementTypes: ["c4.container"]
        targetElementTypes: ["c4.component"]
      - sourceElementTypes: ["c4.component"]
        targetElementTypes: ["implementation.*"]
    bidirectional: false
    relationshipType: "aggregation"
    prefillLabel: false
    reverse:
      name: "contained in"
      description: "Elements contained in this environment"
      descriptionDetailed: "The reverse of the 'Contains' relationship. When an element is contained in an environment, the environment 'is contained in' that element. This represents the organizational perspective of environment grouping."
    style:
      style: "dashed"
      startArrow: "none"
      endArrow: "arrow_filled"
      defaultColor: "#6f6f6f"
      thickness: 1

# Property Groups
propertyGroups:
  - id: "c4-uses-details"
    name: "C4 Uses Relationship Details"
    description: "Technical and communication details for C4 'uses' relationships, including communication interactionStyle (sync/async), protocol, technology, data format, and authentication"
    descriptionDetailed: "This property group contains all the technical details relevant to a C4 'uses' relationship. It includes the communication scope (synchronous or asynchronous), the communication protocol (HTTP, gRPC, etc.), the technology or API type (REST, GraphQL, etc.), the data format used (JSON, XML, etc.), and the authentication method. Use this group when you need to document the technical specifics of how one element uses another element in a C4 model."
    properties:
      - fieldName: "interactionStyle"
        displayName: "Communication Scope"
        description: "Whether the communication is synchronous (request-response) or asynchronous (fire-and-forget, message-based)"
        descriptionDetailed: "The communication interactionStyle indicates how the source element invokes or interacts with the target. Synchronous communication blocks until a response is received (e.g., REST call, RPC). Asynchronous communication does not wait for an immediate response (e.g., message queue, event bus, fire-and-forget)."
        type: "selection"
        required: false
        defaultValue: "sync"
        options:
          - key: "sync"
            displayName: "Synchronous"
            description: "Request-response; caller waits for response"
          - key: "async"
            displayName: "Asynchronous"
            description: "Fire-and-forget or message-based; no immediate response"
      - fieldName: "uses-protocol"
        displayName: "Protocol"
        description: "The communication protocol used for this relationship (e.g., HTTP, HTTPS, gRPC, WebSocket)"
        descriptionDetailed: "The network or communication protocol used when the source element interacts with the target element. Common protocols include HTTP, HTTPS, gRPC, WebSocket, TCP, UDP, AMQP, MQTT, and others. This helps document the technical details of how elements communicate."
        type: "selection"
        required: false
        defaultValue: "http"
        options:
          - key: "http"
            displayName: "HTTP"
            description: "Hypertext Transfer Protocol"
          - key: "https"
            displayName: "HTTPS"
            description: "HTTP Secure (TLS/SSL)"
          - key: "grpc"
            displayName: "gRPC"
            description: "Google Remote Procedure Call"
          - key: "websocket"
            displayName: "WebSocket"
            description: "WebSocket protocol for bidirectional communication"
          - key: "tcp"
            displayName: "TCP"
            description: "Transmission Control Protocol"
          - key: "udp"
            displayName: "UDP"
            description: "User Datagram Protocol"
          - key: "amqp"
            displayName: "AMQP"
            description: "Advanced Message Queuing Protocol"
          - key: "mqtt"
            displayName: "MQTT"
            description: "Message Queuing Telemetry Transport"
          - key: "other"
            displayName: "Other"
            description: "Other protocol not listed"
      - fieldName: "uses-technology"
        displayName: "Technology/API Type"
        description: "The technology or API type used for this relationship (e.g., REST API, GraphQL, SOAP)"
        descriptionDetailed: "The specific technology or API type used for communication between the source and target elements. This describes the architectural style or technology stack used for the interaction, such as REST API, GraphQL, SOAP, GraphQL, or database-specific protocols."
        type: "selection"
        required: false
        defaultValue: "rest"
        options:
          - key: "rest"
            displayName: "REST API"
            description: "Representational State Transfer API"
          - key: "graphql"
            displayName: "GraphQL"
            description: "GraphQL query language API"
          - key: "soap"
            displayName: "SOAP"
            description: "Simple Object Access Protocol"
          - key: "database"
            displayName: "Database Protocol"
            description: "Direct database connection (SQL, NoSQL, etc.)"
          - key: "message-queue"
            displayName: "Message Queue"
            description: "Message queue or event bus"
          - key: "file-system"
            displayName: "File System"
            description: "File system access"
          - key: "other"
            displayName: "Other"
            description: "Other technology or API type"
      - fieldName: "uses-data-format"
        displayName: "Data Format"
        description: "The data format used for communication (e.g., JSON, XML, Protocol Buffers)"
        descriptionDetailed: "The data serialization format used when exchanging data between the source and target elements. Common formats include JSON, XML, Protocol Buffers, Avro, MessagePack, and others. This helps document the data exchange format."
        type: "selection"
        required: false
        defaultValue: "json"
        options:
          - key: "json"
            displayName: "JSON"
            description: "JavaScript Object Notation"
          - key: "xml"
            displayName: "XML"
            description: "Extensible Markup Language"
          - key: "protobuf"
            displayName: "Protocol Buffers"
            description: "Google Protocol Buffers"
          - key: "avro"
            displayName: "Avro"
            description: "Apache Avro"
          - key: "messagepack"
            displayName: "MessagePack"
            description: "MessagePack binary format"
          - key: "csv"
            displayName: "CSV"
            description: "Comma-Separated Values"
          - key: "other"
            displayName: "Other"
            description: "Other data format"
      - fieldName: "uses-authentication"
        displayName: "Authentication Method"
        description: "The authentication method used for this relationship (e.g., OAuth, API Key, Basic Auth)"
        descriptionDetailed: "The authentication or authorization mechanism used to secure the relationship between the source and target elements. This documents how access is controlled and authenticated."
        type: "selection"
        required: false
        options:
          - key: "none"
            displayName: "None"
            description: "No authentication required"
          - key: "api-key"
            displayName: "API Key"
            description: "API key authentication"
          - key: "oauth2"
            displayName: "OAuth 2.0"
            description: "OAuth 2.0 authentication"
          - key: "oauth1"
            displayName: "OAuth 1.0"
            description: "OAuth 1.0 authentication"
          - key: "basic-auth"
            displayName: "Basic Auth"
            description: "HTTP Basic Authentication"
          - key: "bearer-token"
            displayName: "Bearer Token"
            description: "Bearer token authentication"
          - key: "certificate"
            displayName: "Certificate"
            description: "Certificate-based authentication"
          - key: "other"
            displayName: "Other"
            description: "Other authentication method"

  - id: "c4-element-common"
    name: "Common Element Properties"
    description: "Common properties for C4 elements including technologies"
    descriptionDetailed: "This property group contains common properties that apply to most C4 elements (Systems, Containers, Components). It includes the technologies used. Use this group to document the technical stack."
    properties:
      - fieldName: "element-technologies"
        displayName: "Technologies"
        description: "Technologies, frameworks, and tools used by this element"
        descriptionDetailed: "A list of technologies, frameworks, libraries, and tools used by this element. This helps document the technical stack and dependencies. Examples include programming languages (Java, Python, JavaScript), frameworks (Spring Boot, React, Django), databases (PostgreSQL, MongoDB), and other technologies."
        type: "multipleSelection"
        required: false
        options:
          - key: "java"
            displayName: "Java"
            description: "Java programming language"
          - key: "python"
            displayName: "Python"
            description: "Python programming language"
          - key: "javascript"
            displayName: "JavaScript"
            description: "JavaScript programming language"
          - key: "typescript"
            displayName: "TypeScript"
            description: "TypeScript programming language"
          - key: "csharp"
            displayName: "C#"
            description: "C# programming language"
          - key: "go"
            displayName: "Go"
            description: "Go programming language"
          - key: "spring-boot"
            displayName: "Spring Boot"
            description: "Spring Boot framework"
          - key: "react"
            displayName: "React"
            description: "React framework"
          - key: "nodejs"
            displayName: "Node.js"
            description: "Node.js runtime"
          - key: "docker"
            displayName: "Docker"
            description: "Docker containerization"
          - key: "kubernetes"
            displayName: "Kubernetes"
            description: "Kubernetes orchestration"
          - key: "postgresql"
            displayName: "PostgreSQL"
            description: "PostgreSQL database"
          - key: "mysql"
            displayName: "MySQL"
            description: "MySQL database"
          - key: "mongodb"
            displayName: "MongoDB"
            description: "MongoDB database"
          - key: "redis"
            displayName: "Redis"
            description: "Redis cache/database"
          - key: "aws"
            displayName: "AWS"
            description: "Amazon Web Services"
          - key: "azure"
            displayName: "Azure"
            description: "Microsoft Azure"
          - key: "gcp"
            displayName: "Google Cloud Platform"
            description: "Google Cloud Platform"
          - key: "other"
            displayName: "Other"
            description: "Other technology not listed"

  - id: "c4-database-details"
    name: "Database Details"
    description: "Database-specific properties including type and version"
    descriptionDetailed: "This property group contains database-specific properties for C4 Database elements. It includes the database type (relational, document store, etc.) and the database version. Use this group when documenting database elements to specify the database technology and version."
    properties:
      - fieldName: "database-type"
        displayName: "Database Type"
        description: "The type of database (e.g., Relational, NoSQL, Document Store)"
        descriptionDetailed: "The category or type of database system. This helps classify databases by their data model and storage approach, such as relational databases, document stores, key-value stores, graph databases, or time-series databases."
        type: "selection"
        required: false
        defaultValue: "relational"
        options:
          - key: "relational"
            displayName: "Relational"
            description: "Relational database (SQL)"
          - key: "document"
            displayName: "Document Store"
            description: "Document-oriented database (NoSQL)"
          - key: "key-value"
            displayName: "Key-Value Store"
            description: "Key-value database"
          - key: "graph"
            displayName: "Graph Database"
            description: "Graph database"
          - key: "time-series"
            displayName: "Time-Series Database"
            description: "Time-series database"
          - key: "column-family"
            displayName: "Column Family"
            description: "Column-family database"
          - key: "file-system"
            displayName: "File System"
            description: "File system storage"
          - key: "other"
            displayName: "Other"
            description: "Other database type"
      - fieldName: "database-version"
        displayName: "Database Version"
        description: "Version of the database software or engine"
        descriptionDetailed: "The specific version of the database software, engine, or system being used. This helps track database versions for compatibility, migration planning, and documentation purposes. Examples include PostgreSQL 14, MongoDB 6.0, MySQL 8.0."
        type: "text"
        required: false

  - id: "c4-infrastructure-details"
    name: "Infrastructure Details"
    description: "Infrastructure-specific properties including provider"
    descriptionDetailed: "This property group contains infrastructure-specific properties for Infrastructure Nodes and Deployment Nodes. It includes the infrastructure provider (AWS, Azure, on-premise, etc.). Use this group when documenting infrastructure nodes to specify where they are hosted."
    properties:
      - fieldName: "infrastructure-provider"
        displayName: "Infrastructure Provider"
        description: "Cloud provider or infrastructure provider (e.g., AWS, Azure, On-Premise)"
        descriptionDetailed: "The infrastructure provider or cloud platform where this infrastructure node is hosted. This helps document where infrastructure is deployed and managed, including cloud providers, on-premise data centers, or hybrid environments."
        type: "selection"
        required: false
        options:
          - key: "aws"
            displayName: "AWS"
            description: "Amazon Web Services"
          - key: "azure"
            displayName: "Azure"
            description: "Microsoft Azure"
          - key: "gcp"
            displayName: "Google Cloud Platform"
            description: "Google Cloud Platform"
          - key: "on-premise"
            displayName: "On-Premise"
            description: "On-premise infrastructure"
          - key: "hybrid"
            displayName: "Hybrid"
            description: "Hybrid cloud environment"
          - key: "other"
            displayName: "Other"
            description: "Other provider"

  - id: "c4-container-deployment"
    name: "Container Deployment"
    description: "Deployment method and information for containers"
    descriptionDetailed: "This property group contains deployment-related properties for Container elements. It includes the deployment method (Docker, Kubernetes, VM, etc.). Use this group when documenting how containers are deployed and managed."
    properties:
      - fieldName: "deployment-method"
        displayName: "Deployment Method"
        description: "How this container is deployed (e.g., Docker, Kubernetes, VM, Serverless)"
        descriptionDetailed: "The deployment method or platform used to deploy this container. This documents how the container is packaged, deployed, and managed, such as Docker containers, Kubernetes pods, virtual machines, serverless functions, or other deployment mechanisms."
        type: "selection"
        required: false
        options:
          - key: "docker"
            displayName: "Docker"
            description: "Docker container"
          - key: "kubernetes"
            displayName: "Kubernetes"
            description: "Kubernetes pod/deployment"
          - key: "vm"
            displayName: "Virtual Machine"
            description: "Virtual machine"
          - key: "serverless"
            displayName: "Serverless"
            description: "Serverless function"
          - key: "bare-metal"
            displayName: "Bare Metal"
            description: "Bare metal server"
          - key: "other"
            displayName: "Other"
            description: "Other deployment method"

textTemplates:
  - id: "c4-person-description"
    name: "Person Description"
    description: "Detailed description of a C4 Person (actor) including role, responsibilities, and interactions"

    content: |
      # Person Name

      ## Role
      Describe the person's role in relation to the system (e.g., End User, Administrator, Customer).

      ## Responsibilities
      List the key responsibilities of this person.

      ## Goals
      Describe what the person wants to achieve when using the system.

      ## Interactions
      Describe how this person interacts with the system, including main use cases and workflows.

      ## Notes
      Add any additional relevant information or context.

# Validations
validations:
  - id: "c4-container-must-have-technology"
    name: "Container Must Have Technology"
    description: "Containers should specify at least one technology to document their technical stack"
    severity: "warning"
    scope:
      elementTypes: ["c4.container"]
    validation: "element.properties.common != null && element.properties.common.element-technologies != null && element.properties.common.element-technologies.length > 0"
    message: "Container '{{element.properties.name}}' should specify at least one technology"
    suggestion: "Add technologies to the container's properties to document its technical stack"

  - id: "c4-database-must-have-type"
    name: "Database Must Have Type"
    description: "Databases should specify their database type (relational, document store, etc.)"
    severity: "warning"
    scope:
      elementTypes: ["c4.database"]
    validation: "element.properties.database != null && element.properties.database['database-type'] != null && element.properties.database['database-type'] != ''"
    message: "Database '{{element.properties.name}}' should specify its database type"
    suggestion: "Add database type to the database's properties (e.g., Relational, Document Store, Key-Value)"

  - id: "c4-container-should-have-deployment-method"
    name: "Container Should Have Deployment Method"
    description: "Containers should specify how they are deployed (Docker, Kubernetes, VM, etc.)"
    severity: "info"
    scope:
      elementTypes: ["c4.container"]
    validation: "element.properties.deployment != null && element.properties.deployment['deployment-method'] != null && element.properties.deployment['deployment-method'] != ''"
    message: "Container '{{element.properties.name}}' could specify its deployment method"
    suggestion: "Add deployment method to document how the container is deployed (e.g., Docker, Kubernetes, VM)"

  - id: "c4-infrastructure-should-have-provider"
    name: "Infrastructure Should Have Provider"
    description: "Infrastructure nodes should specify their infrastructure provider (AWS, Azure, on-premise, etc.)"
    severity: "info"
    scope:
      elementTypes: ["c4.infrastructure-node", "c4.deployment-node"]
    validation: "element.properties.infrastructure != null && element.properties.infrastructure['infrastructure-provider'] != null && element.properties.infrastructure['infrastructure-provider'] != ''"
    message: "Infrastructure node '{{element.properties.name}}' could specify its infrastructure provider"
    suggestion: "Add infrastructure provider to document where the infrastructure is hosted (e.g., AWS, Azure, On-Premise)"

  - id: "c4-uses-relationship-should-have-protocol"
    name: "Uses Relationship Should Have Protocol"
    description: "Uses relationships should specify the communication protocol (HTTP, gRPC, etc.)"
    severity: "info"
    scope:
      relationshipTypes: ["c4.uses"]
    validation: "relationship.properties.details != null && relationship.properties.details['uses-protocol'] != null && relationship.properties.details['uses-protocol'] != ''"
    message: "Uses relationship from '{{relationship.source.properties.name}}' to '{{relationship.target.properties.name}}' could specify the communication protocol"
    suggestion: "Add protocol information to document how the elements communicate (e.g., HTTP, HTTPS, gRPC)"

  - id: "c4-system-should-have-containers"
    name: "System Should Have Containers"
    description: "Systems should contain at least one container to represent their internal structure"
    severity: "warning"
    scope:
      elementTypes: ["c4.system"]
    validation: "element.relationships[type == 'c4.contains' && source == element].count() > 0"
    message: "System '{{element.properties.name}}' should contain at least one container"
    suggestion: "Add containers to the system to represent its internal structure"

  - id: "c4-container-should-have-relationships"
    name: "Container Should Have Relationships"
    description: "Containers should have at least one relationship (uses or communicates-with) to show how they interact"
    severity: "info"
    scope:
      elementTypes: ["c4.container"]
    validation: "element.relationships[type == 'c4.uses' || type == 'c4.communicates-with'].count() > 0"
    message: "Container '{{element.properties.name}}' could have relationships to show how it interacts with other elements"
    suggestion: "Add relationships (uses or communicates-with) to document how the container interacts with other containers, databases, or systems"

# Metadata
metadata:
  tags:
    - "c4"
    - "architecture"
    - "software-design"
  source: "https://c4model.com/"
