"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getServerAllHouseInfo = exports.getServerList = exports.serverList = exports.servers = exports.dc_server = exports.territories = exports.HouseSize = void 0;
const axios_1 = __importDefault(require("axios"));
const axios = axios_1.default.create({
    baseURL: "https://wanahome.ffxiv.bingyin.org/"
});
/**
 * 吐槽：这个项目的API格式太难顶了……搞了半天没搞懂怎么回事……
 * 而且很多数据都是前端维护，所以如果前端更新不及时就会显示出错，难顶+1
 */
var HouseSize;
(function (HouseSize) {
    HouseSize[HouseSize["SMALL"] = 1] = "SMALL";
    HouseSize[HouseSize["MEDIUM"] = 2] = "MEDIUM";
    HouseSize[HouseSize["LARGE"] = 3] = "LARGE";
})(HouseSize = exports.HouseSize || (exports.HouseSize = {}));
exports.territories = {
    339: { full: "海雾村", short: "海" },
    340: { full: "薰衣草苗圃", short: "森" },
    341: { full: "高脚孤丘", short: "沙" },
    641: { full: "白银乡", short: "白" },
    979: { full: "穹顶皓天", short: "天" }
};
exports.dc_server = [
    {
        dc_name: "陆行鸟",
        servers: {
            1042: "拉诺西亚",
            1044: "幻影群岛",
            1060: "萌芽池",
            1081: "神意之地",
            1167: "红玉海",
            1173: "宇宙和音",
            1174: "沃仙曦染",
            1175: "晨曦王座"
        }
    },
    {
        dc_name: "莫古力",
        servers: {
            1076: "白金幻象",
            1113: "旅人栈桥",
            1121: "拂晓之间",
            1166: "龙巢神殿",
            1170: "潮风亭",
            1171: "神拳痕",
            1172: "白银乡",
            1176: "梦羽宝境"
        }
    },
    {
        dc_name: "猫小胖",
        servers: {
            1043: "紫水栈桥",
            1045: "摩杜纳",
            1106: "静语庄园",
            1169: "延夏",
            1177: "海猫茶屋",
            1178: "柔风海湾",
            1179: "琥珀原"
        }
    },
    {
        dc_name: "豆豆柴",
        servers: {
            1183: "银泪湖",
            1192: "水晶塔",
            1180: "太阳海岸",
            1186: "伊修加德",
            1201: "红茶川"
        }
    }
];
exports.servers = (() => {
    const servers = {};
    exports.dc_server.forEach(d => {
        for (const id in d.servers)
            servers[id] = d.servers[id];
    });
    return servers;
})();
exports.serverList = (() => {
    const serverList = [];
    exports.dc_server.forEach(d => {
        for (const server in d.servers)
            serverList.push(server);
    });
    return serverList;
})();
async function getServerList() {
    const result = await axios.get("/api/list/", {
        headers: {
            Cookie: "api-version=1",
            Referer: "https://wanahome.ffxiv.bingyin.org/"
        }
    });
    return result.data.data;
}
exports.getServerList = getServerList;
async function getServerAllHouseInfo(server) {
    const result = await axios.get("/api/state/", {
        params: {
            server,
            type: 0
        },
        headers: {
            Cookie: "api-version=1",
            Referer: `https://wanahome.ffxiv.bingyin.org/state/${server}`
        }
    });
    return result.data;
}
exports.getServerAllHouseInfo = getServerAllHouseInfo;
