import { useEnumStore } from '@/stores'

const { getEnumTypeList, getEnumTypeName } = useEnumStore()

/**
 * 买卖方向
 */
export enum BuyOrSell {
    Buy = 0, // 买
    Sell = 1, // 卖
}

/**
 * 获取买卖方向列表
 * @returns 
 */
export function getBuyOrSellList() {
    return [
        { label: '买入', value: BuyOrSell.Buy },
        { label: '卖出', value: BuyOrSell.Sell },
    ]
}

/**
 * 获取买卖方向名称
 * @returns 
 */
export function getBuyOrSellName(value: number) {
    return getEnumTypeName(getBuyOrSellList(), value)
}

/**
 * 获取交割方式类型列表
 * @returns 
 */
export function getTHJDeliveryModeList() {
    return getEnumTypeList('thjDeliveryMode')
}

/**
 * 获取交割方式类型名称
 * @returns 
 */
export function getTHJDeliveryModeName(value: number) {
    const enums = getTHJDeliveryModeList()
    return getEnumTypeName(enums, value)
}

/**
 * 获取单据状态类型列表
 * @returns 
 */
export function getTHJOrderStatusList() {
    return getEnumTypeList('thjOrderStatus')
}

/**
 * 获取单据状态类型名称
 * @returns 
 */
export function getTHJOrderStatusName(value: number) {
    const enums = getTHJDeliveryModeList()
    return getEnumTypeName(enums, value)
}