import { NetManager } from "../libs/tw/manager/NetManager";


export class NetPromise {
    private static instance: NetPromise;

    public static get ins(): NetPromise {
        if (!this.instance) {
            this.instance = new NetPromise();
        }
        return this.instance;
    }

    constructor() {}

    getPetInfoKuwo(){
        let  promise = new Promise((resolve,reject)=>{
			NetManager.ins.getPetInfoKuwo((success)=>{
				if(!success){
                    reject(success)
				}
				resolve(success)
			},window["CFG"].activityId)
        })

        promise.then((response)=>{
            return response;
        },(response)=>{
            return response;
        });

        return promise;
    }

    petInteractionKuwo(petId,type){
        let  promise = new Promise((resolve,reject)=>{
            NetManager.ins.petInteractionKuwo((success)=>{
                if(!success){
                    reject(success)
                }
                resolve(success)
            },petId,type,window["signId"])
        })
        promise.then((response)=>{
            return response;
        }).catch((response)=>{
            return response;
        });

        return promise;
    }
}