import { TFOutput, TFInput, PageData, MessageData } from './types'; // 假设这些类型定义在 types.ts 文件中

// 定义 ATMAmountClearing 类，对应 C# 中的同名类
export class ATMAmountClearing extends TFOutput {
    // 输出属性
    public QJJE: string | null = null;
    public BZW: string | null = null;
    public ATMTEL: string | null = null;

    // 输入类
    public static Input = class Input extends TFInput {
        public ATMGYH: string | null = null;
        public ATMQCNO: string | null = null;

        // 重写 Raise 方法
        public override Raise(): ATMAmountClearing {
            const output = new ATMAmountClearing();
            PageData.TradeAPIs.InitFd(MessageData);
            PageData.TradeAPIs.CommSend(MessageData);
            MessageData.Fd126_5 = this.MainCode;
            MessageData.Fd16 = "K051";
            MessageData.Fd92 = this.ATMGYH;
            MessageData.Fd58 = this.ATMQCNO;
            PageData.TradeAPIs.CallServer(MessageData);

            if (MessageData.Fd12 !== "0000") {
                output.IsFailed = true;
                output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
            }

            output.QJJE = MessageData.Fd40;
            output.BZW = MessageData.Fd73;
            output.ATMTEL = MessageData.Fd92;
            return output;
        }
    };
}