module yumaworks-yang-api {

  namespace "http://yumaworks.com/ns/yumaworks-yang-api";

  prefix "yapi";
  
  import ietf-inet-types { prefix inet; }  
  import yuma-ncx { prefix ncx; }
  import yumaworks-extensions { prefix ywx; }

  organization "YumaWorks, Inc.";

  contact
    "Support <support@yumaworks.com>";

  description
    "This module contains abstract object definitions for 
     the YANG-API protocol.";

  revision 2024-06-18 {
    description
       "Change type of leaf 'depth' from uint32 to uint16";
  }

  revision 2015-06-19 {
    description
       "Add yang leaf for root of schema retrieval for YANG-API";
  }

  revision 2013-12-14 {
    description 
       "Remove unimplemented YANG extension";
  }

  revision 2013-10-14 {
    description 
       "Add /yang-api/events to provide test SSE hook";
  }

  revision 2013-02-06 {
    description
       "Rewrite to match draft-bierman-netconf-yang-api-01.txt";
  }

  revision 2012-06-28 {
    description 
       "Initial version";
  }

  container yang-api {
    ncx:abstract;
    ncx:hidden;

    container datastore {
      ncx:root;
    }
    container modules {
      leaf-list module {
        type inet:uri;
      }
    }
    container operations {
      ywx:rpc-root;
    }

    // temp before replacing with ietf-restconf.yang
    leaf events {
      type empty;
    }

    leaf version {
      type string;
    }
    leaf yang {
      type empty;
    }
  }
      
  container query {
    ncx:abstract;
    ncx:hidden;
    description "YANG-API Query String Parameters";

    leaf config {
      type boolean;
      default true;
      description "Get config true or config false nodes.";
    }

    leaf depth {
      type union {
        type enumeration {
          enum unbounded;
        }
        type uint16 {
          range "1..max";
        }
      }
      default unbounded;   // set to 1 in draft-01!
      description "Resource retrieval depth requested";
    }

    leaf format {
      type enumeration {
        enum xml;
        enum json;
      }
      default json;
      description "Response encoding requested";
    }

    leaf insert {
      type enumeration {
        enum first;
        enum last;
        enum before;
        enum after;
      }
      default last;
      description "Insert mode for an edit operation";
    }

    leaf point {
      ywx:urlpath;
      type string {
        length "1 .. max";
      }
      description 
        "YANG-API instance identifier for the insertion point
         node for the edit operation.";
    }

    leaf select {
      // ywx:urlpath;   !! NOT IMPLEMENTED AS A URLPATH!!!
      type string {
        length "1 .. max";
      }
      description
        "An XPath expression that will be evaluated using the
         target resource instance as the context node and the
         document root. It is expected to return a node-set
         result representing the descendants within the context
         node that should be returned in a GET response.";

    }

    leaf test {
      // ywx:urlpath;   !! NOT IMPLEMENTED AS A URLPATH!!!
      type string {
        length "1 .. max";
      }
    }

  }
  
}

