/*
 * @Author: xiejiang
 * @Date: 2024-11-28 16:01:55
 * @LastEditors: xiejiang
 * @LastEditTime: 2024-12-05 14:21:14
 * @Description:
 * Copyright（c）2024 by 好老师教育科技有限公司 All right Reserved.
 */
/**
 * @description 返回 状态文字
 * @param {String} key 状态值
 * @returns {String}
 */
export const statusTxt = (key: string | number) => {
  const objMap = [
    { value: 1, title: '编辑中', class: 'status-brand' },
    { value: 2, title: '启用', class: 'status-success' },
    { value: 3, title: '停用', class: 'status-gray' }
  ]
  return objMap.find(item => item.value === key)
}

/**
 * @description 返回 版本状态文字
 * @param {String} key 状态值
 * @returns {String}
 */
export const statusVersionTxt = (key: string | number) => {
  const objMap = [
    { value: 1, title: '开发中', class: 'status-brand' },
    { value: 2, title: '已发布', class: 'status-success' },
    { value: 3, title: '已下线', class: 'status-gray' }
  ]
  return objMap.find(item => item.value === key)
}

// 字典属性l列表
export const dictionaryAttributes = [
  { value: 1, label: '允许编辑', class: 'dictionary-subset' },
  { value: 2, label: '不允许编辑', class: 'dictionary-unSubset' },
  { value: 3, label: '允许添加子集', class: 'dictionary-del' },
  { value: 4, label: '不允许添加子集', class: 'dictionary-unDel' },
  { value: 5, label: '允许删除', class: 'dictionary-edit' },
  { value: 6, label: '不允许删除', class: 'dictionary-unEdit' }
]

/**
 * @description 返回 字典属性文字
 * @param {String} key 状态值
 * @returns {String}
 */
export const dictionaryAttributeTxt = (key: string | number) => {
  return dictionaryAttributes.find(item => item.value === key)
}
