////
/// @group tools
////

/// Conditional Compatibility Mixin
///
/// Selectively output a block (available to the mixin as @content) if a given
/// $product is also identified as being used in the project.
///
/// This can then be used to include styles that are only needed to override
/// styles provided by those other products (e.g. where govuk_template has a
/// very specific link selector that otherwise affects buttons).
///
/// @example scss
///   // Override .my-class if GOV.UK Template is also being used
///   @include govuk-compatibility(govuk_template) {
///     .my-class {
///       color: inherit;
///     }
///   }
///
/// @param {String} $product - Name of product that we are 'defending' against.
/// @content Passed content is outputted only if Frontend is being used with
///   this product
/// @throw Errors if product name is not recognised
/// @access public

@mixin govuk-compatibility($product) {
  @if map-has-key($_govuk-compatibility, $product) {
    @if map-get($_govuk-compatibility, $product) == true {
      @content;
    }
  } @else {
    @error "Non existent product '#{$product}'";
  }
}
