module ietf-yang-library-semver {
  yang-version 1.1;
  namespace
    "urn:ietf:params:xml:ns:yang:ietf-yang-library-semver";
  prefix yl-semver;

  import ietf-yang-semver {
    prefix ysv;
    reference
      "XXXX: YANG Semantic Versioning";
  }
  import ietf-yang-library {
    prefix yanglib;
    reference
      "RFC 8525: YANG Library";
  }

  organization
    "IETF NETMOD (Network Modeling) Working Group";
  contact
    "WG Web:   <https://datatracker.ietf.org/wg/netmod/>
     WG List:  <mailto:netmod@ietf.org>

     Author:   Joe Clarke
               <mailto:jclarke@cisco.com>

     Author:   Reshad Rahman
               <mailto:reshad@yahoo.com>

     Author:   Robert Wilton
               <mailto:rwilton@cisco.com>

     Author:   Balazs Lengyel
               <mailto:balazs.lengyel@ericsson.com>

     Author:   Jason Sterne
               <mailto:jason.sterne@nokia.com>";
  description
    "This module contains augmentations to YANG Library to add module
     and submodule level version identifiers.

     Copyright (c) 2025 IETF Trust and the persons identified as
     authors of the code.  All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject
     to the license terms contained in, the Revised BSD License
     set forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (http://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX; see
     the RFC itself for full legal notices.

     The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
     NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
     'MAY', and 'OPTIONAL' in this document are to be interpreted as
     described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
     they appear in all capitals, as shown here.";

  // RFC Ed.: update the date below with the date of RFC publication
  // and remove this note.
  // RFC Ed.: replace XXXX (including in the imports above) with
  // actual RFC number and remove this note.
  // RFC Ed.: please replace ysv:version with 1.0.0 and
  // remove this note.

  revision 2025-01-21 {
    ysv:version "0.20.0";
    description
      "Initial revision";
    reference
      "RFC XXXX: YANG Semantic Versioning";
  }

  // library 1.0 modules-state is not augmented with version

  augment "/yanglib:yang-library/yanglib:module-set/yanglib:module" {
    description
      "Add a version to module information";
    leaf version {
      type ysv:version;
      description
        "The version associated with this module revision.
         The value MUST match the version value in the
         specific revision of the module loaded in this module-set.";
      reference
        "RFC XXXX: YANG Semantic Versioning;
         Section 7.1.1, Advertising version";
    }
  }

  augment
    "/yanglib:yang-library/yanglib:module-set/yanglib:module/"
  + "yanglib:submodule" {
    description
      "Add a version to submodule information";
    leaf version {
      type ysv:version;
      description
        "The version associated with this submodule revision.
         The value MUST match the version value in the
         specific revision of the submodule included by the module
         loaded in this module-set.";
      reference
        "RFC XXXX: YANG Semantic Versioning;
         Section 7.1.1, Advertising version";
    }
  }

  augment "/yanglib:yang-library/yanglib:module-set/"
        + "yanglib:import-only-module" {
    description
      "Add a version to module information";
    leaf version {
      type ysv:version;
      description
        "The version associated with this module revision.
         The value MUST match the version value in the
         specific revision of the module included in this
         module-set.";
      reference
        "RFC XXXX: YANG Semantic Versioning;
         Section 7.1.1, Advertising version";
    }
  }

  augment "/yanglib:yang-library/yanglib:module-set/"
        + "yanglib:import-only-module/yanglib:submodule" {
    description
      "Add a version to submodule information";
    leaf version {
      type ysv:version;
      description
        "The version associated with this submodule revision.
         The value MUST match the version value in the specific
         revision of the submodule included by the import-only-module
         loaded in this module-set.";
      reference
        "RFC XXXX: Updated YANG Module Revision Handling;
         Section 7.1.1, Advertising version";
    }
  }
}
