import { Application, ChannelService, HandlerService, } from 'pinus';
import { reloadResources } from '../../../pubUtils/data';
import { taflush, treatGuildName } from '../../../services/sdkService';
import { getServerMainten, setServerMainten, stopServerMainten } from '../../../services/gmService';

export default function (app: Application) {
    new HandlerService(app, {});
    return new GuildRemote(app);
}

export class GuildRemote {

    constructor(private app: Application) {
        this.app = app;
        this.channelService = app.get('channelService');
    }

    private channelService: ChannelService;

    /**
     * 重载json资源
     */
    public async reloadResources() {
        reloadResources();
    }

    public async treatGuildName(content: string) {
        await treatGuildName(content);
    }

    public setServerMainten(serverIds: number[], startTime: number, endTime: number) {
        setServerMainten(serverIds, startTime, endTime);
    }

    public stopServerMainten(serverIds: number[]) {
        stopServerMainten(serverIds);
    }

    public getServerMainten(serverId: number) {
        return getServerMainten(serverId);
    }

    public taflush() {
        return taflush();
    }
}