@use '../../../../utils/map' as *;
@use '../../../../typography/functions' as *;
@use '../elevation/switch' as *;

////
/// @package theming
/// @group schemas
/// @access public
////

// stylelint-disable max-line-length

/// Generates a base light switch schema.
/// @type Map
/// @prop {Map} thumb-on-color [color: ('gray', 50)] - The color of the thumb when the switch is on.
/// @prop {Map} track-on-color [color: ('primary', 500)] - The color of the track when the switch is on.
/// @prop {Color} track-off-color [transparent] - The color of the track when the switch is off.
/// @prop {Map} thumb-on-disabled-color [color: ('secondary', 100)] - The color of the thumb when the switch is on and disabled.
/// @prop {Color} track-disabled-color [transparent] - The color of the track when the switch is disabled.
/// @prop {Map} label-color [color: ('gray', 900)] - The color of the switch label.
/// @prop {Map} label-hover-color [color: ('gray', 900)] - The color of the switch label on hover.
/// @prop {Map} label-disabled-color [color: ('gray', 500)] - The color of the switch label when the switch is disabled
/// @prop {Map} border-on-color [color: ('primary', 500)] - The border color of the on-switch.
/// @prop {Map} track-on-disabled-color [color: ('secondary', 50)] - The color of the track when the switch is on and disabled.
/// @prop {List} border-radius-thumb [(rem(10px), rem(0), rem(10px))] - The border radius used for switch thumb.
/// @prop {List} border-radius-ripple [(rem(24px), rem(0), rem(24px))] - The border radius used for switch ripple.
/// @prop {Map} typography [label: (value: 'body-2')] - The typography styles used for the component.
$light-switch: extend(
    (
        border-on-color: (
            color: (
                'primary',
                500,
            ),
        ),
        track-on-color: (
            color: (
                'primary',
                500,
            ),
        ),
        track-disabled-color: transparent,
        track-off-color: transparent,
        thumb-on-color: (
            color: (
                'gray',
                50,
            ),
        ),
        thumb-on-disabled-color: (
            color: (
                'secondary',
                100,
            ),
        ),
        label-color: (
            color: (
                'gray',
                900,
            ),
        ),
        label-hover-color: (
            color: (
                'gray',
                900,
            ),
        ),
        label-disabled-color: (
            color: (
                'gray',
                500,
            ),
        ),
        track-on-disabled-color: (
            color: (
                'secondary',
                50,
            ),
        ),
        border-radius-thumb: (
            border-radius: (
                rem(10px),
                rem(0),
                rem(10px),
            ),
        ),
        border-radius-ripple: (
            border-radius: (
                rem(24px),
                rem(0),
                rem(24px),
            ),
        ),
        typography: (
            label: (
                value: 'body-2',
            ),
        ),
        _meta: (
            name: 'switch',
            variant: 'light',
        ),
    )
);

/// Generates a material switch schema.
/// @type Map
/// @prop {Color} focus-outline-color [transparent] - The focus outlined color.
/// @prop {Color} border-color [transparent] - The border color of the switch.
/// @prop {Color} border-hover-color [transparent] - The border color of the switch on hover.
/// @prop {Color} focus-fill-color [transparent] - The focus fill color.
/// @prop {Color} focus-fill-hover-color [transparent] - The focus fill color on hover.
/// @prop {Color} border-on-color [transparent] - The border color of the on-switch.
/// @prop {Color} border-on-hover-color [transparent] - The hover border color when the switch is on.
/// @prop {Color} border-disabled-color [transparent] - The border color of the disabled switch.
/// @prop {Map} thumb-on-color [color: ('secondary', 500)] - The color of the thumb when the switch is on.
/// @prop {Map} thumb-off-color [color: ('gray', 50)] - The color of the thumb when the switch is off.
/// @prop {Map} thumb-off-hover-color [color: ('gray', 50)] - The color of the thumb when the switch is off and hovered.
/// @prop {Map} thumb-disabled-color [color: ('gray', 200)] - The color of the thumb when the switch is disabled.
/// @prop {Map} track-off-color [color: ('gray', 500)] - The color of the track when the switch is off.
/// @prop {Map} track-on-color [color: ('secondary', 200)] - The color of the track when the switch is on.
/// @prop {Map} track-on-hover-color [color: ('secondary', 200)] - The color of the track when the switch is on and hovered.
/// @prop {Map} track-disabled-color [color: ('gray', 300)] - The color of the track when the switch is disabled.
/// @prop {List} border-radius-track [(rem(7px), rem(0), rem(7px))] - The border radius used for switch track.
/// @prop {Number} resting-elevation [1] - The elevation level, between 0-24, to be used for the resting state.
/// @prop {Number} hover-elevation [1] - The elevation level, between 0-24, to be used for the hover state.
/// @prop {Number} disabled-elevation [1] - The elevation level, between 0-24, to be used for the disabled state.
/// @prop {Map} typography [label: (value: 'subtitle-1')] - The typography styles used for the component.
/// @requires $light-switch
/// @requires $default-elevation-switch
$material-switch: extend(
    $light-switch,
    $default-elevation-switch,
    (
        focus-outline-color: transparent,
        border-color: transparent,
        border-hover-color: transparent,
        focus-fill-color: transparent,
        focus-fill-hover-color: transparent,
        border-on-color: transparent,
        border-on-hover-color: transparent,
        border-disabled-color: transparent,
        thumb-on-color: (
            color: (
                'secondary',
                500,
            ),
        ),
        thumb-off-color: (
            color: (
                'gray',
                50,
            ),
        ),
        thumb-off-hover-color: (
            color: (
                'gray',
                50,
            ),
        ),
        thumb-disabled-color: (
            color: (
                'gray',
                200,
            ),
        ),
        track-off-color: (
            color: (
                'gray',
                500,
            ),
        ),
        track-on-color: (
            color: (
                'secondary',
                200,
            ),
        ),
        track-on-hover-color: (
            color: (
                'secondary',
                200,
            ),
        ),
        track-disabled-color: (
            color: (
                'gray',
                300,
            ),
        ),
        border-radius-track: (
            border-radius: (
                rem(7px),
                rem(0),
                rem(7px),
            ),
        ),
        typography: (
            label: (
                value: 'subtitle-1',
            ),
        ),
        _meta: (
            theme: 'material',
        ),
    )
);

/// Generates a fluent switch schema.
/// @type Map
/// @prop {Map} border-color [color: ('gray', 700)] - The border color of the switch.
/// @prop {Map} border-hover-color [color: ('gray', 900)] - The border color of the switch on hover.
/// @prop {Map} focus-fill-color [color: ('gray', 700)] - The focus fill color.
/// @prop {Map} focus-fill-hover-color [color: ('gray', 900)] - The focus fill color on hover.
/// @prop {Map} border-disabled-color [color: ('gray', 400)] - The border color of the disabled switch.
/// @prop {Map} border-on-hover-color [color: ('primary', 800)] - The border color of the on-switch.
/// @prop {Map} thumb-off-color [color: ('gray', 700)] - The color of the thumb when the switch is off.
/// @prop {Map} thumb-off-hover-color [color: ('gray', 900)] - The color of the thumb when the switch is off and hovered.
/// @prop {Map} track-disabled-color [contrast-color: ('primary', 800)] - The color of the track when the switch is disabled.
/// @prop {Map} track-on-hover-color [color: ('primary', 800)] - The color of the track when the switch is on and hovered.
/// @prop {Map} track-on-disabled-color [color: ('gray', 400)] - The color of the track when the switch is on and disabled.
/// @prop {Map} track-off-color [contrast-color: ('gray', 900)] - The color of the track when the switch is off.
/// @prop {Map} thumb-disabled-color [color: ('gray', 400)] - The color of the thumb when the switch is disabled.
/// @prop {Map} thumb-on-disabled-color [color: ('gray', 100)] - The color of the thumb when the switch is on and disabled.
/// @prop {Map} focus-outline-color [color: ('gray', 700)] - The focus outlined color.
/// @prop {List} border-radius-track [(rem(10px), rem(0), rem(10px))] - The border radius used for switch track.
/// @requires $light-switch
$fluent-switch: extend(
    $light-switch,
    (
        focus-outline-color: (
            color: (
                'gray',
                700,
            ),
        ),
        border-color: (
            color: (
                'gray',
                700,
            ),
        ),
        thumb-off-color: (
            color: (
                'gray',
                700,
            ),
        ),
        thumb-off-hover-color: (
            color: (
                'gray',
                900,
            ),
        ),
        border-hover-color: (
            color: (
                'gray',
                900,
            ),
        ),
        focus-fill-color: (
            color: (
                'gray',
                700,
            ),
        ),
        focus-fill-hover-color: (
            color: (
                'gray',
                900,
            ),
        ),
        track-disabled-color: (
            contrast-color: (
                'primary',
                800,
            ),
        ),
        track-on-hover-color: (
            color: (
                'primary',
                800,
            ),
        ),
        border-on-hover-color: (
            color: (
                'primary',
                800,
            ),
        ),
        track-off-color: (
            contrast-color: (
                'gray',
                900,
            ),
        ),
        track-on-disabled-color: (
            color: (
                'gray',
                400,
            ),
        ),
        thumb-disabled-color: (
            color: (
                'gray',
                400,
            ),
        ),
        thumb-on-disabled-color: (
            color: (
                'gray',
                100,
            ),
        ),
        border-disabled-color: (
            color: (
                'gray',
                400,
            ),
        ),
        border-radius-track: (
            border-radius: (
                rem(10px),
                rem(0),
                rem(10px),
            ),
        ),
        _meta: (
            theme: 'fluent',
        ),
    )
);

/// Generates a bootstrap switch schema.
/// @type Map
/// @prop {Map} track-on-hover-color [color: ('primary', 600)] - The color of the track when the switch is on and hovered.
/// @prop {Map} focus-outline-color [color: ('primary', 200, 0.5)] - The focus outlined color.
/// @prop {Map} focus-fill-color [color: ('primary', 200)] - The focus fill color.
/// @prop {Map} focus-fill-hover-color [color: ('primary', 300)] - The focus fill color on hover.
/// @prop {Map} border-color [color: ('gray', 400)] - The border color of the switch.
/// @prop {Map} border-hover-color [color: ('gray', 500)] - The border color of the switch on hover.
/// @prop {Map} border-on-hover-color [color: ('primary', 600)] - The border color of the on-switch.
/// @prop {Map} border-disabled-color [color: ('gray', 300)] - The border color of the disabled switch.
/// @prop {Map} thumb-on-color [contrast-color: ('primary', 800)] - The color of the thumb when the switch is on.
/// @prop {Map} thumb-off-color [color: ('gray', 400)] - The color of the thumb when the switch is off.
/// @prop {Map} thumb-off-hover-color [color: ('gray', 500)] - The color of the thumb when the switch is off and hovered.
/// @prop {Map} thumb-disabled-color [color: ('gray', 300)] - The color of the thumb when the switch is disabled.
/// @prop {Map} track-on-disabled-color [color: ('primary', 200)] - The color of the track when the switch is on and disabled.
/// @prop {Map} thumb-on-disabled-color [contrast-color: ('primary', 800)] - The color of the thumb when the switch is on and disabled.
/// @prop {List} border-radius-track [(rem(32px), rem(0), rem(32px))] - The border radius used for switch track.
/// @prop {List} border-radius-thumb [(rem(32px), rem(0), rem(32px))] - The border radius used for switch thumb.
/// @prop {Map} typography [label: (value: 'body-2')] - The typography styles used for the component.
/// @requires $fluent-switch
$bootstrap-switch: extend(
    $fluent-switch,
    (
        track-on-hover-color: (
            color: (
                'primary',
                600,
            ),
        ),
        focus-outline-color: (
            color: (
                'primary',
                200,
                0.5,
            ),
        ),
        focus-fill-color: (
            color: (
                'primary',
                200,
            ),
        ),
        focus-fill-hover-color: (
            color: (
                'primary',
                300,
            ),
        ),
        border-color: (
            color: (
                'gray',
                400,
            ),
        ),
        border-hover-color: (
            color: (
                'gray',
                500,
            ),
        ),
        border-on-hover-color: (
            color: (
                'primary',
                600,
            ),
        ),
        border-disabled-color: (
            color: (
                'gray',
                300,
            ),
        ),
        thumb-on-color: (
            contrast-color: (
                'primary',
                800,
            ),
        ),
        thumb-off-color: (
            color: (
                'gray',
                400,
            ),
        ),
        thumb-off-hover-color: (
            color: (
                'gray',
                500,
            ),
        ),
        thumb-disabled-color: (
            color: (
                'gray',
                300,
            ),
        ),
        thumb-on-disabled-color: (
            contrast-color: (
                'primary',
                800,
            ),
        ),
        track-on-disabled-color: (
            color: (
                'primary',
                200,
            ),
        ),
        border-radius-track: (
            border-radius: (
                rem(32px),
                rem(0),
                rem(32px),
            ),
        ),
        border-radius-thumb: (
            border-radius: (
                rem(32px),
                rem(0),
                rem(32px),
            ),
        ),
        typography: (
            label: (
                value: 'body-2',
            ),
        ),
        _meta: (
            theme: 'bootstrap',
        ),
    )
);

/// Generates an indigo switch schema.
/// @type Map
/// @prop {Map} label-color [color: ('gray', 800)] - The color of the switch label.
/// @prop {Map} label-disabled-color [color: ('gray', 900, .2)] - The color of the switch label when the switch is disabled
/// @prop {Map} thumb-on-color [contrast-color: ('gray', 900)] - The color of the thumb when the switch is on.
/// @prop {Map} track-on-hover-color [color: ('primary', 400)] - The color of the track when the switch is on and hovered.
/// @prop {Map} thumb-off-color [color: ('gray', 500)] - The color of the thumb when the switch is off.
/// @prop {Map} thumb-off-hover-color [color: ('gray', 600)] - The color of the thumb when the switch is off and hovered.
/// @prop {Map} thumb-disabled-color [color: ('gray', 900, .15)] - The color of the thumb when the switch is disabled.
/// @prop {Map} thumb-on-disabled-color [contrast-color: ('gray', 900, .4)] - The color of the thumb when the switch is on and disabled.
/// @prop {Map} track-on-disabled-color [color: ('primary', 400, .5)] - The color of the track when the switch is on and disabled.
/// @prop {Map} border-color [color: ('gray', 500)] - The border color of the switch.
/// @prop {Map} border-hover-color [color: ('gray', 600)] - The border color of the switch on hover.
/// @prop {Map} border-disabled-color [color: ('gray', 900, .15)] - The border color of the disabled switch.
/// @prop {Map} border-on-hover-color [color: ('primary', 400)] - The hover border color when the switch is on.
/// @prop {List} border-radius-track [(rem(8px), rem(0), rem(8px))] - The border radius used for switch track.
/// @prop {Map} focus-outline-color [color: ('gray', 900, .15)] - The focus outlined color.
/// @prop {Map} focus-outline-color-focused [color: ('primary', 400, .5)] - The focus outlined color for focused state.
/// @requires $light-switch
$indigo-switch: extend(
    $light-switch,
    (
        label-color: (
            color: (
                'gray',
                800,
            ),
        ),
        label-disabled-color: (
            color: (
                'gray',
                900,
                0.2,
            ),
        ),
        thumb-on-color: (
            contrast-color: (
                'gray',
                900,
            ),
        ),
        thumb-on-disabled-color: (
            contrast-color: (
                'gray',
                900,
                0.4,
            ),
        ),
        track-on-hover-color: (
            color: (
                'primary',
                400,
            ),
        ),
        track-on-disabled-color: (
            color: (
                'primary',
                400,
                0.5,
            ),
        ),
        focus-outline-color: (
            color: (
                'gray',
                900,
                0.15,
            ),
        ),
        focus-outline-color-focused: (
            color: (
                'primary',
                400,
                0.5,
            ),
        ),
        border-color: (
            color: (
                'gray',
                500,
            ),
        ),
        border-hover-color: (
            color: (
                'gray',
                600,
            ),
        ),
        focus-fill-color: (
            color: (
                'gray',
                500,
            ),
        ),
        focus-fill-hover-color: (
            color: (
                'gray',
                500,
            ),
        ),
        border-disabled-color: (
            color: (
                'gray',
                900,
                0.15,
            ),
        ),
        border-on-hover-color: (
            color: (
                'primary',
                400,
            ),
        ),
        thumb-off-color: (
            color: (
                'gray',
                500,
            ),
        ),
        thumb-off-hover-color: (
            color: (
                'gray',
                600,
            ),
        ),
        thumb-disabled-color: (
            color: (
                'gray',
                900,
                0.15,
            ),
        ),
        border-radius-track: (
            border-radius: (
                rem(8px),
                rem(0),
                rem(8px),
            ),
        ),
        _meta: (
            theme: 'indigo',
        ),
    )
);
