/*
 * Copyright (C) 2021 The Gravitee team (http://gravitee.io)
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *         http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
@use 'sass:map';
@use '@angular/material' as mat;

@use '../../scss/gio-mat-palettes.scss' as palettes;
@use '../../scss/gio-mat-theme-variable' as theme;

/**
 * Gravitee.io version of bootstrap "badge" element dedicated to HTTP verbs
 */
@mixin theme() {
  %gio-method-badge-base {
    display: inline-flex;
    width: 72px;
    height: 24px;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 6px;
    margin-right: 4px;
    margin-left: 4px;
    font-size: mat.m2-font-size(theme.$mat-typography, caption);
    font-weight: mat.m2-font-weight(theme.$mat-typography, caption);
    line-height: 16px;
    text-align: center;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
  }

  .gio-method-badge {
    @extend %gio-method-badge-base;
  }

  .gio-method-badge-post {
    @extend %gio-method-badge-base;

    background-color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, post);
    color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, post-contrast);
  }

  .gio-method-badge-get {
    @extend %gio-method-badge-base;

    background-color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, get);
    color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, get-contrast);
  }

  .gio-method-badge-patch {
    @extend %gio-method-badge-base;

    background-color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, patch);
    color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, patch-contrast);
  }

  .gio-method-badge-put {
    @extend %gio-method-badge-base;

    background-color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, put);
    color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, put-contrast);
  }

  .gio-method-badge-delete {
    @extend %gio-method-badge-base;

    background-color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, delete);
    color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, delete-contrast);
  }

  .gio-method-badge-options {
    @extend %gio-method-badge-base;

    background-color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, option);
    color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, option-contrast);
  }

  .gio-method-badge-trace {
    @extend %gio-method-badge-base;

    background-color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, trace);
    color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, trace-contrast);
  }

  .gio-method-badge-head {
    @extend %gio-method-badge-base;

    background-color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, head);
    color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, head-contrast);
  }

  .gio-method-badge-connect {
    @extend %gio-method-badge-base;

    background-color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, connect);
    color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, connect-contrast);
  }

  .gio-method-badge-other {
    @extend %gio-method-badge-base;

    background-color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, other);
    color: mat.m2-get-color-from-palette(palettes.$mat-method-palette, other-contrast);
  }
}
