
;; Copyright (C) 2026 Tommi Höynälänmaa

;; Distributed under GNU Lesser General Public License.

(define-interface (theme-d-intr dbus interfaces)


  (import (standard-library core))


  (import (theme-d-intr dbus types))


  (define <dbus-direction>
    (:union (:singleton-type 'in) (:singleton-type 'out)))


  (define <dbus-access>
    (:union (:singleton-type 'readwrite)
            (:singleton-type 'read)
            (:singleton-type 'write)))


  (define-class <dbus-entity>
    (attributes abstract)
    (fields
     (str-name <string> public public)))


  (define-class <dbus-argument>
    (inheritance-access hidden)
    (fields
     (str-name <string> public public)
     (sx-type <dbus-type-repr> public public)
     (s-direction <dbus-direction> public public)))


  (define-class <dbus-method>
    (superclass <dbus-entity>)
    (inheritance-access hidden)
    (fields
     (l-in-args (:uniform-list <dbus-argument>) public public)
     (l-out-args (:uniform-list <dbus-argument>) public public)))


  (define-class <dbus-signal>
    (superclass <dbus-entity>)
    (inheritance-access hidden)
    (fields
     (l-args (:uniform-list <dbus-argument>) public public)))


  (define-class <dbus-property>
    (superclass <dbus-entity>)
    (inheritance-access hidden)
    (fields
      (sx-type <dbus-type-repr> public public)
      (s-access <dbus-access> public public)))
          

  (define-class <dbus-interface>
    (inheritance-access hidden)
    (fields
     (str-name <string> public public)
     (l-entities (:uniform-list <dbus-entity>) public public)))


  (declare-simple-method load-interfaces
    (<string>) (:uniform-list <dbus-interface>) nonpure)


  (declare-simple-method generate-intf-interface
      (<dbus-interface> (:uniform-list <symbol>))
       <source-expr> pure)


  (declare-simple-method generate-intf-body
      (<dbus-interface> (:uniform-list <symbol>))
       <source-expr> pure))


