module yumaworks-restconf {
  namespace "urn:ietf:params:xml:ns:yang:yumaworks-restconf";
  prefix "yrc";

  import ietf-yang-types { prefix yang; }
  import ietf-restconf { prefix rc; }
  import yang-data-ext { prefix yd; }

  organization "YumaWorks, Inc.";

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

  description
    "This module contains abstract object definitions for
     the RESTCONF protocol.";


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

  revision 2024-02-15 {
    description
       "Add 'streams' leaf to restconf struct augment";
  }

  revision 2023-10-31 {
    description
       "Add RESTCONF Extensions to Support NMDA";
  }

  revision 2017-07-03 {
    description
       "Convert plain augment to augment-yang-data";
  }

  revision 2017-03-29 {
    description
       "Update text to use restconf by reference.";
  }

  revision 2015-12-03 {
    description
       "Move restconf grouping back to ietf-restconf and
        augment it with 2 leafs.";
  }

  revision 2015-07-29 {
    description
       "Initial version";
  }

  yd:augment-yang-data /rc:restconf {
      leaf stream {
        type empty;
        description
          "Used for the event-streams. (legacy)

           This is the legacy RESTCONF stream that is really
           the NETCONF stream.  Use the 'restconf/streams/NETCONF'
           URI instead of 'restconf/stream'.";
      }
      leaf streams {
        type empty;
        description
          "Used for the event-streams. (current).

           This is the current RESTCONF streams root that expects
           the stream name to follow in the URI.
           Read the 'restconf/data//restconf/streams' subtree
           for info on the available RESTCONF event streams.

           Introduced: 23.10-6
          ";
      }
      leaf yang {
        type empty;
        description
          "Used for the schema retriaval";
      }
      leaf ds {
        type empty;
        description
          "Used for the NMDA support";
      }
  }

  grouping content-parameter {
    leaf content {
      type enumeration {
        enum config {
          description
            "Return only configuration descendant data nodes";
        }
        enum nonconfig {
          description
            "Return only non-configuration descendant data nodes";
        }
        enum all {
          description
            "Return all descendant data nodes";
        }
      }
      description
        "The content parameter from RESTCONF.";
      reference "RFC 8040";
    }
  }

  grouping depth-parameter {
    description "IETF RESTCONF depth parameter";
    leaf depth {
      type union {
        type enumeration {
          enum unbounded {
            description "All sub-resources will be returned.";
          }
        }
        type uint16 {
          range "1..max";
        }
      }
      default unbounded;
        description
          "The 'depth' parameter from RESTCONF";
        reference "RFC 8040.";
    }
  }

  grouping query-parameters {
    description
        "Contains conceptual definitions for the query string
        parameters used in the RESTCONF protocol.";

    uses content-parameter;

    uses depth-parameter;

    leaf filter {
      type yang:xpath1.0;
        description
          "The 'filter' parameter from RESTCONF.";
        reference "RFC 8040.";
    }

    leaf insert {
      type enumeration {
        enum first {
          description "Insert the new data as the new first entry.";
        }
        enum last {
          description "Insert the new data as the new last entry.";
        }
        enum before {
          description
            "Insert the new data before the insertion point,
             specified by the value of the 'point' parameter.";
        }
        enum after {
          description
            "Insert the new data after the insertion point,
             specified by the value of the 'point' parameter.";
        }
      }
      default last;
        description
          "The 'insert' parameter from RESTCONF";
        reference "RFC 8040";
    }

    leaf point {
        //  type data-resource-identifier;
        type string;
        description
          "The 'point' parameter from RESTCONF.";
        reference "RFC 8040";
    }

    leaf start-time {
      type yang:date-and-time;
        description
          "The 'start-time' parameter from RESTCONF";
        reference "RFC 8040";
    }

    leaf stop-time {
      type yang:date-and-time;
        description
          "The 'stop-time' parameter from RESTCONF";
        reference "RFC 8040";
    }

    leaf with-origin {
      type empty;
      description
        "The with-origin parameter from RESTCONF Extensions to Support NMDA.";
      reference "RFC 8527";
    }
  }  // grouping query-parameters


}
