import pg from "../pg";
import { ITEMS, USER } from "../config/config"
import user from "../model/user";
import kitchen from "../model/kitchen";
//获取信息，购买物品，使用物品（吃东西），穿戴衣服/更换家具
class Api {
    static askUser() {
        return new Promise((resolve, reject) => {
            pg.http.send("GET", "http://www.baidu.com", {}).then((data: any) => {
                let userInfo = USER;
                user.parse(userInfo);
                let kitchenInfo = ITEMS;
                kitchen.parse(kitchenInfo);
                resolve('');
            })
        });
    }
    static askUseItem(data) {
        return new Promise((resolve, reject) => {
            pg.http.send("GET", "http://www.baidu.com", {}).then((data: any) => {
                user.addGrowth(data.growthValue);
                kitchen.use(data.id);
                resolve('');
            })
        });
    }
    static askBuyItem(data) {
        return new Promise((resolve, reject) => {
            data.id;
            data.type;
            pg.http.send("GET", "http://www.baidu.com", {}).then((data: any) => {
                user.useCoin(data.cost * data.discount);
                kitchen.buy(data.id);
                resolve('');
            })
        });
    }
}
export default Api;