package com.bocloud.cmp.provider.compute;

import com.bocloud.cmp.model.*;
import com.bocloud.cmp.model.azure.automation.LogAnalyticModel;
import com.bocloud.cmp.model.fusionsphere.CdromModel;
import com.bocloud.cmp.model.h3c.H3cMigrateModel;
import com.bocloud.cmp.model.h3c.H3cServerModel;
import com.bocloud.cmp.model.sangfor.SangforServerModel;
import com.bocloud.cmp.provider.SuperProvider;
import com.bocloud.common.model.BocloudResult;

import java.util.List;

/**
 * 云主机操作服务接口
 *
 * @author weiwei
 */
public interface ServerProvider extends SuperProvider {
    /**
     * 云主机列表
     *
     * @return
     */
    default BocloudResult list() {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 查询宿主机下的云主机列表
     *
     * @param hostId
     * @return
     */
    default BocloudResult list(String hostId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 创建云主机
     *
     * @param server
     * @return
     */
    default BocloudResult create(ServerModel server) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 更新云主机
     *
     * @param server
     * @return
     */
    default BocloudResult modify(ServerModel server) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 云主机迁移
     *
     * @param server
     * @return
     */
    default BocloudResult migrate(ServerModel server) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 云主机迁移
     *
     * @param model
     * @return
     */
    default BocloudResult migrate(OSMigrateModel model) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 删除云主机
     *
     * @param instanceId
     * @param name
     * @return
     */
    default BocloudResult remove(String instanceId, String name) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult remove(String instanceId, Integer force) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 删除云主机
     *
     * @param instanceId
     * @param
     * @return
     */
    default BocloudResult remove(String instanceId, Boolean deletePublicIp, Boolean deleteVolume) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 云主机详细
     *
     * @param instanceId
     * @return
     */
    default BocloudResult detail(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 启动云主机
     *
     * @param instanceId
     * @return
     */
    default BocloudResult start(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 停止云主机
     *
     * @param instanceId
     * @return
     */
    default BocloudResult stop(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult addNetwork(ServerModel server) {
        return new BocloudResult(false, "尚未实现");
    };
    default BocloudResult removeNetwork(ServerModel server) {
        return new BocloudResult(false, "尚未实现");
    };

    default BocloudResult addDisks(ServerModel server) {
        return new BocloudResult(false, "尚未实现");
    };
    /**
     * 软停止云主机
     *
     * @param instanceId
     * @return
     */
    default BocloudResult softStop(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 重启云主机
     *
     * @param instanceId
     * @return
     */
    default BocloudResult reboot(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 软重启云主机
     *
     * @param instanceId
     * @return
     */
    default BocloudResult softReboot(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 休眠云主机
     *
     * @param instanceId
     * @return
     */
    default BocloudResult pause(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 取消休眠云主机
     *
     * @param instanceId
     * @return
     */
    default BocloudResult unPause(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 挂起云主机
     *
     * @param instanceId
     * @return
     */
    default BocloudResult suspend(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 恢复挂起的云主机
     *
     * @param instanceId
     * @return
     */
    default BocloudResult resume(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 加入安全组
     *
     * @param instanceId
     * @param group
     * @return
     */
    default BocloudResult joinSGroup(String instanceId, String group) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 离开安全组
     *
     * @param instanceId
     * @param group
     * @return
     */
    default BocloudResult leaveSGroup(String instanceId, String group) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 创建快照
     *
     * @param snapshotModel
     * @return
     */
    default BocloudResult snapshot(SnapshotModel snapshotModel) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * console接口
     *
     * @param vncType  novnc and xvpvnc
     * @param serverId
     * @return
     */
    default BocloudResult vncConsole(String vncType, String serverId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 修改云主机密码
     *
     * @param instanceId
     * @param password
     * @return
     */
    default BocloudResult changePassword(String instanceId, String password) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 挂载网卡(openstack)
     *
     * @param server
     * @return
     */
    default BocloudResult attachNetwork(ServerModel server) {
        return new BocloudResult(false, "尚未实现");
    }


    default BocloudResult sangforInterfacesList(){
        return new BocloudResult(false,"尚未实现");
    }

    default BocloudResult sangforCommunication(){
        return new BocloudResult(false,"尚未实现");
    }


    /**
     * 卸载网卡(openstack)
     *
     * @param instanceId
     * @param portUuid
     * @return
     */
    default BocloudResult detachNetwork(String instanceId, String portUuid) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 修改配置
     *
     * @param instanceId
     * @param flavorId
     * @return
     */
    default BocloudResult resize(String instanceId, String flavorId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 修改配置
     *
     * @param server
     * @param flavor
     * @return
     */
    default BocloudResult resize(ServerModel server, FlavorModel flavor)  {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 确认修改配置
     *
     * @param instanceId
     * @return
     */
    default BocloudResult confirmResize(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 回滚修改配置
     *
     * @param instanceId
     * @return
     */
    default BocloudResult revertResize(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 设置CPU或内存热插拔
     *
     * @param instanceId
     * @param cpuHotEnable
     * @param MemHotEnable
     * @return
     */
    default BocloudResult hotConfigEnable(String instanceId, Boolean cpuHotEnable, Boolean MemHotEnable) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 获得vcenter访问remote console的ticket
     *
     * @param instanceId
     * @return
     */
    default BocloudResult getTicket(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 指定资源池创建云主机
     *
     * @param server
     * @return
     */
    default BocloudResult createInResPool(ServerModel server) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 挂载vmware tools安装镜像
     *
     * @param instanceId
     * @return
     */
    default BocloudResult mountToolsInstaller(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 卸载vmware tools安装镜像
     *
     * @param instanceId
     * @return
     */
    default BocloudResult unmountToolsInstaller(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 升级vmware tools
     *
     * @param instanceId
     * @param options
     * @return
     */
    default BocloudResult upgradeToolsTask(String instanceId, String options) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 获取云主机或模板下网络适配器
     *
     * @param instanceId
     * @return
     */
    default BocloudResult getNetCard(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 获取云主机IP(已安装vmware tools的云主机)
     *
     * @param instanceId
     * @return
     */
    default BocloudResult getVmIps(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 获取云主机IP(已安装vmware tools的云主机)
     *
     * @param instanceId
     * @param address
     * @return
     */
    default BocloudResult getVmIps(String instanceId, String address) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 标记为模板(vmware)
     *
     * @param instanceId
     * @return
     */
    default BocloudResult markAsTemplate(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 修改vcenter云主机密码
     *
     * @param instanceId
     * @param oldPasswd
     * @param newPasswd
     * @return
     */
    default BocloudResult changeVspVmPasswd(String instanceId, String oldPasswd, String newPasswd) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 初始化vcenter云主机密码
     *
     * @param instanceId
     * @param oldPasswd
     * @param newPasswd
     * @return
     */
    default BocloudResult initVspVmPasswd(String instanceId, String oldPasswd, String newPasswd) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * vcenter云主机磁盘扩容
     *
     * @param instanceId
     * @param diskLabel
     * @param extendSize
     * @return
     */
    default BocloudResult diskExtend(String instanceId, String diskLabel, Integer extendSize) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 获取云主机性能数据
     *
     * @param type
     * @return
     */
    default BocloudResult getMetric(String type) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 获取vcenter客户端控制台URL
     *
     * @param instanceId
     * @return
     */
    default BocloudResult vmrcConsole(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 迁移
     *
     * @param model
     * @return
     */
    default BocloudResult migrate(H3cMigrateModel model) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 创建华三云云主机
     *
     * @param server
     * @return
     */
    default BocloudResult create(H3cServerModel server) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 获取jnlp控制台
     *
     * @param vmId
     * @param address
     * @return
     */
    default BocloudResult getJnlpXml(Long vmId, String address) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 调整网络上限
     *
     * @param instanceId
     * @param internetMaxBandwidthOut
     * @return
     */
    default BocloudResult resetInternetMaxBandwidthOut(String instanceId, Integer internetMaxBandwidthOut) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 重装系统
     *
     * @param serverModel
     * @return
     */
    default BocloudResult resetInstance(ServerModel serverModel) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 切换系统
     *
     * @param serverModel
     * @return
     */
    default BocloudResult changeInstance(ServerModel serverModel) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 绑定秘钥
     *
     * @param serverModel
     * @return
     */
    default BocloudResult bindKeypair(ServerModel serverModel) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 解绑秘钥
     *
     * @param serverModel
     * @return
     */
    default BocloudResult unbindKeypair(ServerModel serverModel) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult resize(String instanceId, String flavorId, Boolean forceStop) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 挂载卷
     *
     * @param instanceId
     * @param volumeModel
     * @return
     */
    default BocloudResult attachVolume(String instanceId, VolumeModel volumeModel) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 设定卷是否在删除云主机的时候也随之删除
     *
     * @param instanceId
     * @param volumeModel
     * @return
     */
    default BocloudResult retachVolume(String instanceId, VolumeModel volumeModel) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 卸载卷
     *
     * @param instanceId
     * @param volumeModel
     * @return
     */
    default BocloudResult detachVolume(String instanceId, VolumeModel volumeModel) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 捕获映像前的操作
     *
     * @param instanceId
     * @param imageModel
     * @return
     */
    default BocloudResult beforeCaptureImage(String instanceId, ImageModel imageModel) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 捕获映像
     *
     * @param instanceId
     * @param imageName
     * @param volumes
     * @return
     */
    default BocloudResult createImage(String instanceId, String imageName, List<String> volumes) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 云主机vmware tools升级配置
     *
     * @param model
     * @return
     */
    default BocloudResult vmToolsConfig(ServerModel model) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 重置状态
     *
     * @param instanceId
     * @return
     */
    default BocloudResult resetStatus(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult listByZone(String zone) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 批量分配安全组 aws
     *
     * @param instanceId
     * @param groups
     * @return
     */
    default BocloudResult allocationSGroups(String instanceId, List<String> groups) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult addPortPolicy(String policyId, String portId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 修改云主机名称
     *
     * @param instanceId
     * @return
     */
    default BocloudResult modifyVmName(String instanceId, String newName) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 绑定子网络接口
     *
     * @param model
     * @return
     */
    default BocloudResult secondBindNics(ServerModel model) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 解绑子网络接口
     *
     * @param model
     * @return
     */
    default BocloudResult secondUnBindNics(ServerModel model) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 修改系统盘配置
     *
     * @param model
     * @return
     */
    default BocloudResult osDiskModify(ServerModel model) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult serverDetail(ServerModel params) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 查询异常云主机的底层报错
     *
     * @param instanceId
     * @return
     */
    default BocloudResult detailFault(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 获取云主机创建文件夹
     *
     * @param vmFolder
     * @param vdcName
     * @return
     */
    default BocloudResult getVmFolder(String vmFolder, String vdcName) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 获取云主机创建文件夹
     *
     * @param parentFolder
     * @param vmFolder
     * @param vdcName
     * @return
     */
    default BocloudResult getVmFolder(String parentFolder, String vmFolder, String vdcName) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 创建关机状态的云主机，后续会对接nsx网络
     *
     * @param server
     * @return
     */
    default BocloudResult createWithoutPowerOff(ServerModel server) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 自定义云主机配置
     *
     * @param server
     * @return
     */
    default BocloudResult customize(ServerModel server) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult listByStack(HeatStackModel stackModel) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult deallocate(String instanceName) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 克隆为云主机
     *
     * @param server
     * @return
     */
    default BocloudResult cloneAsVm(ServerModel server) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 克隆为模板
     *
     * @param server
     * @return
     */
    default BocloudResult cloneAsTemplate(ServerModel server) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 转化为模板
     *
     * @param server
     * @return
     */
    default BocloudResult convertAsTemplate(ServerModel server) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 整机快照恢复
     *
     * @param snapshotModel
     * @return
     */
    default BocloudResult rebuildServer(SnapshotModel snapshotModel) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 开启disk uuid
     *
     * @param instanceId
     * @return
     */
    default BocloudResult enableDiskUuid(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 设置云主机终止保护
     *
     * @param instanceId
     * @return
     */
    default BocloudResult disableApiTermination(String instanceId, Boolean enabled) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult createTag(ServerModel model) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult removeTag(ServerModel model) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 删除磁盘
     *
     * @param instanceId
     * @param diskNames
     * @return
     */
    default BocloudResult deleteDisk(String instanceId, List<String> diskNames) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 查询磁盘Uuid
     *
     * @param instanceId
     * @param diskNames
     * @return
     */
    default BocloudResult selectDiskUuid(String instanceId, List<String> diskNames) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult customizationVm(ServerModel model) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 分配Ipv6
     *
     * @return
     */
    default BocloudResult assignIpv6(String networkInterfaceId, String ipv6) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult setFields(String instanceId, List<TagModel> tagModels) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult removeFields(String instanceId, List<String> keys) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult listByHost(String hostName) {
        return new BocloudResult(false, "尚未实现");
    }

    //azure-云主机扩展
    default BocloudResult extension(ServerModel server, String extensionName, LogAnalyticModel analyticModel) {
        return new BocloudResult(false, "尚未实现");
    }

    // 开启一般化 azure
    default BocloudResult generalize(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult availableSizes(String instanceId) {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult showServerLimitsSolution() {
        return new BocloudResult(false, "尚未实现");
    }

    //fc 休眠
    default BocloudResult hibernated(String instanceId){
        return null;
    }

    default BocloudResult listByVdc(String siteUri) {
        return new BocloudResult(false, "need implement");
    }

    //挂载光驱
    default BocloudResult attachCdrom (CdromModel cdromModel) {
        return new BocloudResult(false, "need implement");
    }
    //卸载光驱
    default BocloudResult detachCdrom (CdromModel cdromModel) {
        return new BocloudResult(false, "need implement");
    }

    default BocloudResult cloneVm(SangforServerModel server) {
        return new BocloudResult(false, "尚未实现");
    }
    default BocloudResult createVm(SangforServerModel server) {
        return new BocloudResult(false, "尚未实现");
    }

    /**
     * 虚拟机分组列表（深信服）
     * @return
     */
    default BocloudResult listGroup() {
        return new BocloudResult(false, "尚未实现");
    }

    default BocloudResult listLabel() {
        return new BocloudResult(false, "尚未实现");
    }
    default BocloudResult listCon(String storage){
        return new BocloudResult(false, "尚未实现");
    }
    default BocloudResult listIso(String storageId){
        return new BocloudResult(false, "尚未实现");
    }
    default BocloudResult process(String upid){
        return new BocloudResult(false, "尚未实现");
    }
    default BocloudResult vnc(String instanceId){
        return new BocloudResult(false, "尚未实现");
    }
    default BocloudResult vncLogin(String instanceId){
        return new BocloudResult(false, "尚未实现");
    }
    default BocloudResult config(String instanceId){
        return new BocloudResult(false, "尚未实现");
    }
}
