@prefix skos:    <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix arch:    <https://meta.linked.archi/core#> .
@prefix am4:     <https://meta.linked.archi/archimate4/onto#> .
@prefix cp:      <https://meta.linked.archi/examples/cloudplatform/onto#> .
@prefix cpmm:    <https://meta.linked.archi/examples/cloudplatform/metamodel#> .
@prefix :        <https://meta.linked.archi/examples/cloudplatform/model/> .

## ═══════════════════════════════════════════════════════════════════════════════
## Example Model — Payment Platform
##
## A realistic model using the Cloud Platform Architecture metamodel.
## 5 microservices, 2 databases, 1 cache, 1 message broker, 3 event topics,
## 1 API gateway, 1 observability stack, 1 Kubernetes cluster, 5 containers.
## ═══════════════════════════════════════════════════════════════════════════════

:PaymentPlatform a arch:Model ;
    skos:prefLabel "Payment Platform"@en ;
    dcterms:description "Example architecture model of a payment platform using the Cloud Platform metamodel."@en ;
    dcterms:creator "Kalin Maldzhanski"^^xsd:string ;
    arch:modelConformsToMetamodel cpmm:CloudPlatformMetamodel .


## ─── Microservices ──────────────────────────────────────────────────────────

:OrderService a cp:Microservice ;
    skos:prefLabel "Order Service"@en ;
    skos:definition "Handles the complete order lifecycle including creation, validation, payment orchestration, and fulfillment tracking."@en ;
    cp:resilienceLevel "critical" ;
    cp:deploymentStrategy "blue-green" ;
    cp:serviceTier "tier-1" ;
    arch:partOfModel :PaymentPlatform .

:PaymentService a cp:Microservice ;
    skos:prefLabel "Payment Service"@en ;
    skos:definition "Processes credit card and bank transfer payments including authorisation, capture, and refund operations."@en ;
    cp:resilienceLevel "critical" ;
    cp:deploymentStrategy "blue-green" ;
    cp:serviceTier "tier-1" ;
    arch:partOfModel :PaymentPlatform .

:NotificationService a cp:Microservice ;
    skos:prefLabel "Notification Service"@en ;
    skos:definition "Sends email, SMS, and push notifications to customers and internal stakeholders based on payment events."@en ;
    cp:resilienceLevel "medium" ;
    cp:deploymentStrategy "rolling" ;
    cp:serviceTier "tier-2" ;
    arch:partOfModel :PaymentPlatform .

:FraudDetectionService a cp:Microservice ;
    skos:prefLabel "Fraud Detection Service"@en ;
    skos:definition "ML-based fraud scoring service that evaluates payment transactions in real-time and assigns risk scores."@en ;
    cp:resilienceLevel "high" ;
    cp:deploymentStrategy "canary" ;
    cp:serviceTier "tier-1" ;
    arch:partOfModel :PaymentPlatform .

:ReportingService a cp:Microservice ;
    skos:prefLabel "Reporting Service"@en ;
    skos:definition "Generates financial reports, transaction analytics dashboards, and settlement reconciliation summaries."@en ;
    cp:resilienceLevel "low" ;
    cp:deploymentStrategy "rolling" ;
    cp:serviceTier "tier-3" ;
    arch:partOfModel :PaymentPlatform .


## ─── API Gateway ────────────────────────────────────────────────────────────

:PaymentGateway a cp:APIGateway ;
    skos:prefLabel "Payment API Gateway"@en ;
    skos:definition "Kong-based API gateway routing external payment API consumers to internal microservices with authentication and rate limiting."@en ;
    arch:partOfModel :PaymentPlatform .

:PaymentGateway am4:serves :OrderService .
:PaymentGateway am4:serves :PaymentService .


## ─── Databases ──────────────────────────────────────────────────────────────

:OrderDB a cp:ManagedDatabase ;
    skos:prefLabel "Orders Database"@en ;
    cp:databaseEngine "PostgreSQL" ;
    arch:partOfModel :PaymentPlatform .

:PaymentDB a cp:ManagedDatabase ;
    skos:prefLabel "Payments Database"@en ;
    cp:databaseEngine "PostgreSQL" ;
    arch:partOfModel :PaymentPlatform .

:OrderService am4:accesses :OrderDB .
:PaymentService am4:accesses :PaymentDB .
:ReportingService am4:accesses :OrderDB .
:ReportingService am4:accesses :PaymentDB .


## ─── Cache ──────────────────────────────────────────────────────────────────

:SessionCache a cp:CacheStore ;
    skos:prefLabel "Session Cache (Redis)"@en ;
    arch:partOfModel :PaymentPlatform .

:OrderService am4:accesses :SessionCache .
:PaymentService am4:accesses :SessionCache .


## ─── Message Broker & Event Topics ──────────────────────────────────────────

:KafkaCluster a cp:MessageBroker ;
    skos:prefLabel "Kafka Cluster"@en ;
    arch:partOfModel :PaymentPlatform .

:OrderEvents a cp:EventTopic ;
    skos:prefLabel "order-events"@en ;
    cp:topicPartitions 12 ;
    arch:partOfModel :PaymentPlatform .

:PaymentEvents a cp:EventTopic ;
    skos:prefLabel "payment-events"@en ;
    cp:topicPartitions 12 ;
    arch:partOfModel :PaymentPlatform .

:FraudAlerts a cp:EventTopic ;
    skos:prefLabel "fraud-alerts"@en ;
    cp:topicPartitions 4 ;
    arch:partOfModel :PaymentPlatform .

## Publishing relationships
:OrderService cp:publishesTo :OrderEvents .
:PaymentService cp:publishesTo :PaymentEvents .
:FraudDetectionService cp:publishesTo :FraudAlerts .

## Subscription relationships
:PaymentService cp:subscribesTo :OrderEvents .
:NotificationService cp:subscribesTo :PaymentEvents .
:NotificationService cp:subscribesTo :FraudAlerts .
:FraudDetectionService cp:subscribesTo :PaymentEvents .
:ReportingService cp:subscribesTo :OrderEvents .
:ReportingService cp:subscribesTo :PaymentEvents .


## ─── Observability ──────────────────────────────────────────────────────────

:Observability a cp:ObservabilityStack ;
    skos:prefLabel "Observability Stack (Prometheus + Grafana + Jaeger)"@en ;
    arch:partOfModel :PaymentPlatform .


## ─── Infrastructure ─────────────────────────────────────────────────────────

:ProdCluster a cp:KubernetesCluster ;
    skos:prefLabel "Production Cluster (eu-west-1)"@en ;
    arch:partOfModel :PaymentPlatform .

## Containers
:OrderContainer a cp:Container ;
    skos:prefLabel "order-service container"@en ;
    cp:containerImage "registry.example.com/order-service:2.1.0" ;
    cp:replicaCount 3 ;
    am4:assignedTo :OrderService ;
    cp:deployedIn :ProdCluster .

:PaymentContainer a cp:Container ;
    skos:prefLabel "payment-service container"@en ;
    cp:containerImage "registry.example.com/payment-service:1.8.2" ;
    cp:replicaCount 4 ;
    am4:assignedTo :PaymentService ;
    cp:deployedIn :ProdCluster .

:NotificationContainer a cp:Container ;
    skos:prefLabel "notification-service container"@en ;
    cp:containerImage "registry.example.com/notification-service:1.3.0" ;
    cp:replicaCount 2 ;
    am4:assignedTo :NotificationService ;
    cp:deployedIn :ProdCluster .

:FraudContainer a cp:Container ;
    skos:prefLabel "fraud-detection container"@en ;
    cp:containerImage "registry.example.com/fraud-detection:3.0.1" ;
    cp:replicaCount 2 ;
    am4:assignedTo :FraudDetectionService ;
    cp:deployedIn :ProdCluster .

:ReportingContainer a cp:Container ;
    skos:prefLabel "reporting-service container"@en ;
    cp:containerImage "registry.example.com/reporting-service:1.1.0" ;
    cp:replicaCount 1 ;
    am4:assignedTo :ReportingService ;
    cp:deployedIn :ProdCluster .

