package com.bocloud.cmp.model.powervc;

/**
 * powervc相关常亮定义
 * @author luyanchao
 * @since 2019/2/12 11:50
 */
public class PowervcConstant {

    public static final String DEFAULT_PROJECT_NAME = "ibm-default";
    public static final String DEFAULT_DOMAIN_NAME = "Default";

    public static final String DEFAULT_OS_AGGREGATE_ID = "1";
    public static final String VOLUME_TEMPLATE_TYPE_COMMON = "通用卷";
    public static final String VOLUME_TEMPLATE_TYPE_SIMPLE = "自动精简配置卷";
    public static final String VOLUME_TEMPLATE_TYPE_COMPRESS = "压缩卷";
    public static final String VOLUME_TEMPLATE_TYPE_HOT = "可热插拔的存储设备";
    public static final Float VOLUME_TEMPLATE_CAPACITY_PERCENT = 2F;
    public static final Float VOLUME_TEMPLATE_WARNING_PERCENT = 80F;
    public static final Float VOLUME_TEMPLATE_GRAINSIZE = 256F;

    public static enum Version {
        v13("1.3"),
        v14("1.4");
        private String value;

        Version(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }

        public static String[] getValues() {
            String[] strings = new String[Version.values().length];
            for (int i = 0; i < Version.values().length; i++) {
                strings[i] = Version.values()[i].getValue();
            }
            return strings;
        }

        public static Version getByValue(String value) {
            for (Version version : Version.values()) {
                if (version.value.equals(value)) {
                    return version;
                }
            }
            return null;
        }
    }

    public static enum ImageStatus {
        queued, // The Image service reserved an image ID for the image in the catalog but did not yet upload any image data.
        saving, // The Image service is in the process of saving the raw data for the image into the backing store.
        active, // The image is active and ready for consumption in the Image service.
        killed, // An image data upload error occurred.
        deleted, // The Image service retains information about the image but the image is no longer available for use.
        pending_delete, // Similar to the deleted status. An image in this state is not recoverable.
        deactivated, // The image data is not available for use.
        uploading, // Data has been staged as part of the interoperable image import process. It is not yet available for use. (Since Image API 2.6)
        importing // The image data is being processed as part of the interoperable image import process, but is not yet available for use. (Since Image API 2.6)
    }

    public static enum CloudServerStatus {
        ACTIVE, // The server is active.
        BUILD, // The server has not finished the original build process.
        DELETED, // The server is permanently deleted.
        ERROR, // The server is in error.
        HARD_REBOOT, // The server is hard rebooting. This is equivalent to pulling the power plug on a physical server, plugging it back in, and rebooting it.
        MIGRATING, // The server is being migrated to a new host.
        PASSWORD, // The password is being reset on the server.
        PAUSED, // In a paused state, the state of the server is stored in RAM. A paused server continues to run in frozen state.
        REBOOT, // The server is in a soft reboot state. A reboot command was passed to the operating system.
        REBUILD, // The server is currently being rebuilt from an image.
        RESCUE, // The server is in rescue mode. A rescue image is running with the original server image attached.
        RESIZE, // Server is performing the differential copy of data that changed during its initial copy. Server is down for this stage.
        REVERT_RESIZE, // The resize or migration of a server failed for some reason. The destination server is being cleaned up and the original source server is restarting.
        SHELVED, // The server is in shelved state. Depending on the shelve offload time, the server will be automatically shelved offloaded.
        SHELVED_OFFLOADED, // The shelved server is offloaded (removed from the compute host) and it needs unshelved action to be used again.
        SHUTOFF, // The server is powered off and the disk image still persists.
        SOFT_DELETED, // The server is marked as deleted but the disk images are still available to restore.
        SUSPENDED, // The server is suspended, either by request or necessity. This status appears for only the XenServer/XCP, KVM, and ESXi hypervisors. Administrative users can suspend an instance if it is infrequently used or to perform system maintenance. When you suspend an instance, its VM state is stored on disk, all memory is written to disk, and the virtual machine is stopped. Suspending an instance is similar to placing a device in hibernation; memory and vCPUs become available to create other instances.
        UNKNOWN, // The state of the server is unknown. Contact your cloud provider.
        VERIFY_RESIZE // System is awaiting confirmation that the server is operational after a move or resize.
    }

    public static enum ServerStatus {
        enabled,
        disabled
    }

    public static enum ServerState {
        up,
        down
    }

    public static enum VolumeStatus {
        creating("creating"), // The volume is being created.
        available("available"), // The volume is ready to attach to an instance.
        reserved("reserved"), // The volume is reserved for attaching or shelved.
        attaching("attaching"), // The volume is attaching to an instance.
        detaching("detaching"), // The volume is detaching from an instance.
        inUser("in-use"), // The volume is attached to an instance.
        maintenance("maintenance"), // The volume is locked and being migrated.
        deleting("deleting"), // The volume is being deleted.
        awaitingTransfer("awaiting-transfer"), // The volume is awaiting for transfer.
        error("error"), // A volume creation error occurred.
        errorDeleting("error_deleting"), // A volume deletion error occurred.
        backingUp("backing-up"), // The volume is being backed up.
        restoringBackup("restoring-backup"), // A backup is being restored to the volume.
        errorBackingUp("error_backing-up"), // A backup error occurred.
        errorRestoring("error_restoring"), // A backup restoration error occurred.
        errorExtending("error_extending"), // An error occurred while attempting to extend a volume.
        downloading("downloading"), // The volume is downloading an image.
        uploading("uploading"), // The volume is being uploaded to an image.
        retyping("retyping"), // The volume is changing type to another volume type.
        extending("extending"); //The volume is being extended.

        private String value;

        VolumeStatus(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }
    }

    public static enum VolumePoolStatus {
        creating("creating"), // The volume is being created.
        available("available"), // The volume is ready to attach to an instance.
        deleting("deleting"), // The volume is being deleted.
        error("error"), // A volume creation error occurred.
        errorDeleting("restoring"), // A volume deletion error occurred.
        restoring("error_deleting"); // A backup is being restored to the volume.

        private String value;

        VolumePoolStatus(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }
    }

}
