@prefix eoc:   <https://eoc.transaction.science/vocab/v1#> .
@prefix sh:    <http://www.w3.org/ns/shacl#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .

# EOC v1 SHACL shapes — validates EOC Receipts + Resolutions
# against the v1 vocabulary. Enforces the four-stage cascade
# enum, the energy-provenance enum, and the carbon-record shape.

eoc:ReceiptShape a sh:NodeShape ;
    sh:targetClass eoc:Receipt ;
    sh:property [ sh:path eoc:stageClosed        ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ;
                  sh:in ( eoc:Cache eoc:KeyValue eoc:Graph eoc:Neural ) ] ;
    sh:property [ sh:path eoc:joulesMicrojoules  ; sh:datatype xsd:nonNegativeInteger ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path eoc:energyProvenance   ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ;
                  sh:in ( eoc:HwShunt eoc:ModelBased eoc:Estimator ) ] ;
    sh:property [ sh:path eoc:inputHash          ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
                  sh:pattern "^[a-f0-9]{64}$" ] ;
    sh:property [ sh:path eoc:outputHash         ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
                  sh:pattern "^[a-f0-9]{64}$" ] ;
    sh:property [ sh:path eoc:closedAt           ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path eoc:modelId            ; sh:datatype xsd:string ; sh:maxCount 1 ] ;
    sh:property [ sh:path eoc:vendorId           ; sh:datatype xsd:string ; sh:maxCount 1 ] .

eoc:CarbonRecordShape a sh:NodeShape ;
    sh:targetClass eoc:CarbonRecord ;
    sh:property [ sh:path eoc:carbonGrams ; sh:datatype xsd:double ; sh:minCount 1 ; sh:maxCount 1 ;
                  sh:minInclusive 0.0 ] .

eoc:QueryShape a sh:NodeShape ;
    sh:targetClass eoc:Query ;
    sh:property [ sh:path eoc:queryText ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] .
