import { reactive } from 'vue'
import { WorkFlowDataHelper } from './WorkFlowDataHelper'
import type { IPage } from '../../Presentation/Interfaces/IPage'

/**
 * 检查数据帮助类
 */
export class CheckDataHelper extends WorkFlowDataHelper {
    constructor(page: IPage) {
        super(page)
    }

    // 复合数据
    get SuperData(): string {
        return this.tradeBusData["SuperData"] || ""
    }
    set SuperData(value: string) {
        this.tradeBusData["SuperData"] = value
    }

    // 复合记录ID
    get SuperId(): string {
        return this.tradeBusData["SuperId"] || ""
    }
    set SuperId(value: string) {
        this.tradeBusData["SuperId"] = value
    }

    // 复合结果
    get SuperFlag(): string {
        return this.tradeBusData["SuperFlag"] || ""
    }
    set SuperFlag(value: string) {
        this.tradeBusData["SuperFlag"] = value
    }

    // 复合柜员
    get SuperTeller(): string {
        return this.tradeBusData["SuperTeller"] || ""
    }
    set SuperTeller(value: string) {
        this.tradeBusData["SuperTeller"] = value
    }

    /**
     * 清理总线中检查相关数据
     * 注意：保留SuperTeller数据不清除
     */
    public ClearCheckData(): void {
        super.ClearWorkFlowData()
        delete this.tradeBusData["SuperData"]
        delete this.tradeBusData["SuperId"]
        delete this.tradeBusData["SuperFlag"]
    }
}

// Vue组合式API封装
export const useCheckDataHelper = (page: IPage) => {
    return reactive(new CheckDataHelper(page))
}