///
//  Copyright (c) 2022 GrowStocks
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in all
//  copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//  SOFTWARE.
///

@use '../theme';
@use '../tokens' as token;

/// Mixin for applying font family.
/// @param {string} $component
/// @param {string} $family
/// @param {string} $intent
/// @return {void} font family styles.
@mixin family($component, $family, $intent: 'create') {
  @include theme.property(
    font-family,
    ('#{$component}-family', theme.token-switch('family-#{$family}', token.primitive-token-switch('family.#{$family}', $family))),
    $intent
  );
}

/// Mixin for applying font size.
/// @param {string} $component
/// @param {string} $size
/// @param {string} $intent
/// @return {void} font size styles.
@mixin size($component, $size, $intent: 'create') {
  @include theme.property(
    font-size,
    ('#{$component}-size', theme.token-switch('size-#{$size}', token.primitive-token-switch('size.#{$size}', $size))),
    $intent
  );
}

/// Mixin for applying font weight.
/// @param {string} $component
/// @param {string} $weight
/// @param {string} $intent
/// @return {void} font weight styles.
@mixin weight($component, $weight, $intent: 'create') {
  @include theme.property(
    font-weight,
    ('#{$component}-weight', theme.token-switch('weight-#{$weight}', token.primitive-token-switch('weight.#{$weight}', $weight))),
    $intent
  );
}

/// Mixin for applying line height.
/// @param {string} $component
/// @param {string} $line-height
/// @param {string} $intent
/// @return {void} line height styles.
@mixin line-height($component, $line-height, $intent: 'create') {
  @include theme.property(
    line-height,
    ('#{$component}-line-height', theme.token-switch('line-height-#{$line-height}', token.primitive-token-switch('line-height.#{$line-height}', $line-height))),
    $intent
  );
}