@prefix arl:   <https://arl.transaction.science/vocab/v1#> .
@prefix sh:    <http://www.w3.org/ns/shacl#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .

# ARL v1 SHACL shapes — validates Claim / Session / Evaluation /
# Attestation against the v1 vocabulary before the document
# crosses a tool boundary. SHACL Core subset only.

arl:ClaimShape a sh:NodeShape ;
    sh:targetClass arl:Claim ;
    sh:property [ sh:path arl:task             ; sh:datatype xsd:string  ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path arl:context          ; sh:datatype xsd:string  ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path arl:validationDepth  ; sh:datatype xsd:integer ; sh:minCount 1 ; sh:maxCount 1 ;
                  sh:minInclusive 1 ; sh:maxInclusive 9 ] ;
    sh:property [ sh:path arl:convergenceClass ; sh:nodeKind sh:IRI       ; sh:minCount 1 ; sh:maxCount 1 ;
                  sh:in ( arl:ConvergenceA arl:ConvergenceB arl:ConvergenceC arl:ConvergenceD arl:ConvergenceE ) ] ;
    sh:property [ sh:path arl:energyProfile    ; sh:nodeKind sh:IRI       ; sh:minCount 1 ; sh:maxCount 1 ;
                  sh:in ( arl:Disclosed arl:Undisclosed ) ] ;
    sh:property [ sh:path arl:securityClass    ; sh:nodeKind sh:IRI       ; sh:minCount 1 ; sh:maxCount 1 ;
                  sh:in ( arl:S0 arl:S1 arl:S2 arl:S3 arl:S4 ) ] ;
    sh:property [ sh:path arl:arlScore         ; sh:datatype xsd:integer  ; sh:maxCount 1 ;
                  sh:minInclusive 1 ; sh:maxInclusive 9 ] .

arl:SessionShape a sh:NodeShape ;
    sh:targetClass arl:Session ;
    sh:property [ sh:path arl:isolationTier    ; sh:nodeKind sh:IRI       ; sh:minCount 1 ; sh:maxCount 1 ;
                  sh:in ( arl:Tier0 arl:Tier1 arl:Tier2 arl:Tier3 ) ] ;
    sh:property [ sh:path arl:replayable        ; sh:datatype xsd:boolean ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path arl:tamperingDetected ; sh:datatype xsd:boolean ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path arl:joulesMicrojoules ; sh:datatype xsd:nonNegativeInteger ; sh:maxCount 1 ] .

arl:AttestationShape a sh:NodeShape ;
    sh:targetClass arl:Attestation ;
    sh:property [ sh:path arl:signature  ; sh:datatype xsd:string   ; sh:minCount 1 ; sh:maxCount 1 ;
                  sh:pattern "^[a-f0-9]{128}$" ] ;
    sh:property [ sh:path arl:publicKey  ; sh:datatype xsd:string   ; sh:minCount 1 ; sh:maxCount 1 ;
                  sh:pattern "^[a-f0-9]{64}$" ] ;
    sh:property [ sh:path arl:signedAt   ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ] .

arl:EvaluationShape a sh:NodeShape ;
    sh:targetClass arl:Evaluation ;
    sh:property [ sh:path arl:inputHash  ; sh:datatype xsd:string   ; sh:maxCount 1 ;
                  sh:pattern "^[a-f0-9]{64}$" ] ;
    sh:property [ sh:path arl:outputHash ; sh:datatype xsd:string   ; sh:maxCount 1 ;
                  sh:pattern "^[a-f0-9]{64}$" ] .
