import { Moment } from "moment";
import { format } from "./String";

export class Config {
    public static url: string = "";
    public static parentUrl: string = "http://10.124.102.10:8002/product/picture";
    // public static url: string = "http://localhost:8002";
    // public static parentUrl: string = "http://112.124.40.88:8999/product/picture";
    // public static parentUrl: string = "http://localhost:8002/product/picture";
    // public static parentUrl: string = "http://rdp.nagr.com.cn:8082/product/picture";
}

export class MicrowaveRadiationConfig {
    private static url: string = Config.parentUrl + "/weibo";
    public static getUrl(station: string, type: string, time: Moment): string {
        return this.url+ '/' + station + '/' + type + '/' + time.format('YYYY/YYYYMM/YYYYMMDD/') + (type === 'T-logP' ? 'T_logP' : type) +  time.format('_YYYYMMDDHHmm.png');
    }
}

export class RamanLidarConfig {
    private static url: string = Config.parentUrl + "/radar";

    public static getUrl(station: string, type: string, time: Moment): string {
        return this.url+ '/' + station + '/' + type + '/' + time.format("YYYY/YYYYMM/YYYYMMDD/") + type + '_day_' + time.format('D.png');
    }
}

export class SynergyEvaluationConfig {
    private static url: string = Config.parentUrl + "/images";
    public static getUrl(tabName: string, elementName: string, type: string): string {
        return format('{3}/ecological-environment/{0}/{1}/{2}.tif', tabName, elementName, type, this.url);
    }
}

export class DecisionSupportConfig {
    private static url: string = Config.parentUrl + "/images";
    public static getUrl(productName: string, imgName: string): string {
        return format('{2}/decision-support/{0}/{1}.tif', productName, imgName, this.url);
    }
}