@prefix ex: <http://example.org/electric/> .
@prefix schema: <https://schema.org/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# Electric Client API Definition

ex:ElectricClient a owl:Class ;
    rdfs:label "ElectricClient" ;
    rdfs:comment "ElectricSQL client for real-time sync" ;
    ex:hasProperty ex:db, ex:sync, ex:isConnected .

ex:db a owl:ObjectProperty ;
    rdfs:label "db" ;
    rdfs:domain ex:ElectricClient ;
    rdfs:range ex:Database ;
    rdfs:comment "SQLite database instance" .

ex:sync a owl:ObjectProperty ;
    rdfs:label "sync" ;
    rdfs:domain ex:ElectricClient ;
    rdfs:range ex:SyncEngine ;
    rdfs:comment "Sync engine instance" .

ex:isConnected a owl:DatatypeProperty ;
    rdfs:label "isConnected" ;
    rdfs:domain ex:ElectricClient ;
    rdfs:range xsd:boolean ;
    rdfs:comment "Connection status" .

# Database Class

ex:Database a owl:Class ;
    rdfs:label "Database" ;
    rdfs:comment "SQLite database interface" ;
    ex:hasMethod ex:execute, ex:query, ex:transaction .

ex:execute a owl:ObjectProperty ;
    rdfs:label "execute" ;
    rdfs:domain ex:Database ;
    rdfs:comment "Execute a SQL statement" ;
    ex:parameter ex:sql, ex:params ;
    ex:returns ex:Result .

ex:query a owl:ObjectProperty ;
    rdfs:label "query" ;
    rdfs:domain ex:Database ;
    rdfs:comment "Query database and return rows" ;
    ex:parameter ex:sql, ex:params ;
    ex:returns ex:Rows .

ex:transaction a owl:ObjectProperty ;
    rdfs:label "transaction" ;
    rdfs:domain ex:Database ;
    rdfs:comment "Execute transaction with rollback support" ;
    ex:parameter ex:callback ;
    ex:returns ex:Promise .

# SyncEngine Class

ex:SyncEngine a owl:Class ;
    rdfs:label "SyncEngine" ;
    rdfs:comment "Real-time synchronization engine" ;
    ex:hasMethod ex:start, ex:stop, ex:subscribe .

ex:start a owl:ObjectProperty ;
    rdfs:label "start" ;
    rdfs:domain ex:SyncEngine ;
    rdfs:comment "Start sync process" ;
    ex:returns ex:Promise .

ex:stop a owl:ObjectProperty ;
    rdfs:label "stop" ;
    rdfs:domain ex:SyncEngine ;
    rdfs:comment "Stop sync process" ;
    ex:returns ex:Promise .

ex:subscribe a owl:ObjectProperty ;
    rdfs:label "subscribe" ;
    rdfs:domain ex:SyncEngine ;
    rdfs:comment "Subscribe to table changes" ;
    ex:parameter ex:tableName ;
    ex:returns ex:Unsubscribe .

# Shape Class

ex:Shape a owl:Class ;
    rdfs:label "Shape" ;
    rdfs:comment "Type-safe query builder" ;
    ex:hasMethod ex:where, ex:orderBy, ex:limit .

ex:where a owl:ObjectProperty ;
    rdfs:label "where" ;
    rdfs:domain ex:Shape ;
    rdfs:comment "Filter records by condition" ;
    ex:parameter ex:condition ;
    ex:returns ex:Shape .

ex:orderBy a owl:ObjectProperty ;
    rdfs:label "orderBy" ;
    rdfs:domain ex:Shape ;
    rdfs:comment "Sort records by field" ;
    ex:parameter ex:field ;
    ex:returns ex:Shape .

ex:limit a owl:ObjectProperty ;
    rdfs:label "limit" ;
    rdfs:domain ex:Shape ;
    rdfs:comment "Limit number of results" ;
    ex:parameter ex:count ;
    ex:returns ex:Shape .
