<script setup lang="ts">
import { ref } from 'vue';
import { traduction } from '@/utils/language';
import { IconRemind } from '@computing/opendesign-icons';
import useStore from '@/stores';
enum IbmaTabId {
  BASIC_SETTING = 'basicSetting',
  LOG = 'log',
  TIMER = 'timer'
}
const smsName = useStore().state.loct.smsName;
const setting = ref({
  active: IbmaTabId.BASIC_SETTING,
  tabs: [
    {
      id: IbmaTabId.BASIC_SETTING,
      label: traduction('IBMA_BASIC_SETTING'),
    },
    {
      id: IbmaTabId.LOG,
      label: traduction('IBMA_LOG', { smsName }),
    },
    {
      id: IbmaTabId.TIMER,
      label: traduction('IBMA_TIMER'),
    },
  ],
});
</script>

<template>
  <el-tabs id="ibmaTabs" v-model="setting.active" class="tabs">
    <div class="alert">
      <el-icon>
        <IconRemind />
      </el-icon>
      <span class="text">
        {{ $t('IBMC_ALERT_INFO', { smsName }) }}
      </span>
    </div>
    <el-tab-pane :label="setting.tabs[0].label" :name="setting.tabs[0].id">
      <div v-if="setting.active==='basicSetting'" :id="setting.tabs[0].id" class="card">
        <slot name="BasicSetting"></slot>
      </div>
    </el-tab-pane>
    <el-tab-pane :label="setting.tabs[1].label" :name="setting.tabs[1].id">
      <div v-if="setting.active==='log'" :id="setting.tabs[1].id" class="card">
        <slot name="Log"></slot>
      </div>
    </el-tab-pane>
    <el-tab-pane :label="setting.tabs[2].label" :name="setting.tabs[2].id">
      <div v-if="setting.active==='timer'" :id="setting.tabs[2].id" class="card">
        <slot name="Timer"></slot>
      </div>
    </el-tab-pane>
  </el-tabs>
</template>

<style lang="scss" scoped>
.tabs {
  margin-top: 16px;
}

:deep(.el-tabs__nav-wrap){
  &::after{
    z-index: 0;
  }
  .el-tabs__nav{
    z-index: 1;
  }
}

.card {
  width: calc(100% - 24px);
  margin-top: 8px;
  border-radius: 4px;
  background-color: var(--o-bg-color-base);
  padding: 24px;
  margin-bottom: 24px;
}
.alert {
  margin-top: 8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background-color: var(--o-color-state-primary-secondary);
  border-radius: 4px;

  .el-icon {
    font-size: 16px;
    margin-right: 8px;
  }

  .text {
    color: var(--o-text-color-primary);
  }
}
</style>
