// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.devtestlabs.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.devtestlabs.models.CustomImagePropertiesCustom;
import com.azure.resourcemanager.devtestlabs.models.CustomImagePropertiesFromPlan;
import com.azure.resourcemanager.devtestlabs.models.CustomImagePropertiesFromVm;
import com.azure.resourcemanager.devtestlabs.models.DataDiskStorageTypeInfo;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

/** A custom image. */
@Fluent
public final class CustomImageInner extends Resource {
    /*
     * The properties of the resource.
     */
    @JsonProperty(value = "properties", required = true)
    private CustomImageProperties innerProperties = new CustomImageProperties();

    /** Creates an instance of CustomImageInner class. */
    public CustomImageInner() {
    }

    /**
     * Get the innerProperties property: The properties of the resource.
     *
     * @return the innerProperties value.
     */
    private CustomImageProperties innerProperties() {
        return this.innerProperties;
    }

    /** {@inheritDoc} */
    @Override
    public CustomImageInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public CustomImageInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the vm property: The virtual machine from which the image is to be created.
     *
     * @return the vm value.
     */
    public CustomImagePropertiesFromVm vm() {
        return this.innerProperties() == null ? null : this.innerProperties().vm();
    }

    /**
     * Set the vm property: The virtual machine from which the image is to be created.
     *
     * @param vm the vm value to set.
     * @return the CustomImageInner object itself.
     */
    public CustomImageInner withVm(CustomImagePropertiesFromVm vm) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CustomImageProperties();
        }
        this.innerProperties().withVm(vm);
        return this;
    }

    /**
     * Get the vhd property: The VHD from which the image is to be created.
     *
     * @return the vhd value.
     */
    public CustomImagePropertiesCustom vhd() {
        return this.innerProperties() == null ? null : this.innerProperties().vhd();
    }

    /**
     * Set the vhd property: The VHD from which the image is to be created.
     *
     * @param vhd the vhd value to set.
     * @return the CustomImageInner object itself.
     */
    public CustomImageInner withVhd(CustomImagePropertiesCustom vhd) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CustomImageProperties();
        }
        this.innerProperties().withVhd(vhd);
        return this;
    }

    /**
     * Get the description property: The description of the custom image.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: The description of the custom image.
     *
     * @param description the description value to set.
     * @return the CustomImageInner object itself.
     */
    public CustomImageInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CustomImageProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the author property: The author of the custom image.
     *
     * @return the author value.
     */
    public String author() {
        return this.innerProperties() == null ? null : this.innerProperties().author();
    }

    /**
     * Set the author property: The author of the custom image.
     *
     * @param author the author value to set.
     * @return the CustomImageInner object itself.
     */
    public CustomImageInner withAuthor(String author) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CustomImageProperties();
        }
        this.innerProperties().withAuthor(author);
        return this;
    }

    /**
     * Get the creationDate property: The creation date of the custom image.
     *
     * @return the creationDate value.
     */
    public OffsetDateTime creationDate() {
        return this.innerProperties() == null ? null : this.innerProperties().creationDate();
    }

    /**
     * Get the managedImageId property: The Managed Image Id backing the custom image.
     *
     * @return the managedImageId value.
     */
    public String managedImageId() {
        return this.innerProperties() == null ? null : this.innerProperties().managedImageId();
    }

    /**
     * Set the managedImageId property: The Managed Image Id backing the custom image.
     *
     * @param managedImageId the managedImageId value to set.
     * @return the CustomImageInner object itself.
     */
    public CustomImageInner withManagedImageId(String managedImageId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CustomImageProperties();
        }
        this.innerProperties().withManagedImageId(managedImageId);
        return this;
    }

    /**
     * Get the managedSnapshotId property: The Managed Snapshot Id backing the custom image.
     *
     * @return the managedSnapshotId value.
     */
    public String managedSnapshotId() {
        return this.innerProperties() == null ? null : this.innerProperties().managedSnapshotId();
    }

    /**
     * Set the managedSnapshotId property: The Managed Snapshot Id backing the custom image.
     *
     * @param managedSnapshotId the managedSnapshotId value to set.
     * @return the CustomImageInner object itself.
     */
    public CustomImageInner withManagedSnapshotId(String managedSnapshotId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CustomImageProperties();
        }
        this.innerProperties().withManagedSnapshotId(managedSnapshotId);
        return this;
    }

    /**
     * Get the dataDiskStorageInfo property: Storage information about the data disks present in the custom image.
     *
     * @return the dataDiskStorageInfo value.
     */
    public List<DataDiskStorageTypeInfo> dataDiskStorageInfo() {
        return this.innerProperties() == null ? null : this.innerProperties().dataDiskStorageInfo();
    }

    /**
     * Set the dataDiskStorageInfo property: Storage information about the data disks present in the custom image.
     *
     * @param dataDiskStorageInfo the dataDiskStorageInfo value to set.
     * @return the CustomImageInner object itself.
     */
    public CustomImageInner withDataDiskStorageInfo(List<DataDiskStorageTypeInfo> dataDiskStorageInfo) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CustomImageProperties();
        }
        this.innerProperties().withDataDiskStorageInfo(dataDiskStorageInfo);
        return this;
    }

    /**
     * Get the customImagePlan property: Storage information about the plan related to this custom image.
     *
     * @return the customImagePlan value.
     */
    public CustomImagePropertiesFromPlan customImagePlan() {
        return this.innerProperties() == null ? null : this.innerProperties().customImagePlan();
    }

    /**
     * Set the customImagePlan property: Storage information about the plan related to this custom image.
     *
     * @param customImagePlan the customImagePlan value to set.
     * @return the CustomImageInner object itself.
     */
    public CustomImageInner withCustomImagePlan(CustomImagePropertiesFromPlan customImagePlan) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CustomImageProperties();
        }
        this.innerProperties().withCustomImagePlan(customImagePlan);
        return this;
    }

    /**
     * Get the isPlanAuthorized property: Whether or not the custom images underlying offer/plan has been enabled for
     * programmatic deployment.
     *
     * @return the isPlanAuthorized value.
     */
    public Boolean isPlanAuthorized() {
        return this.innerProperties() == null ? null : this.innerProperties().isPlanAuthorized();
    }

    /**
     * Set the isPlanAuthorized property: Whether or not the custom images underlying offer/plan has been enabled for
     * programmatic deployment.
     *
     * @param isPlanAuthorized the isPlanAuthorized value to set.
     * @return the CustomImageInner object itself.
     */
    public CustomImageInner withIsPlanAuthorized(Boolean isPlanAuthorized) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CustomImageProperties();
        }
        this.innerProperties().withIsPlanAuthorized(isPlanAuthorized);
        return this;
    }

    /**
     * Get the provisioningState property: The provisioning status of the resource.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid).
     *
     * @return the uniqueIdentifier value.
     */
    public String uniqueIdentifier() {
        return this.innerProperties() == null ? null : this.innerProperties().uniqueIdentifier();
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property innerProperties in model CustomImageInner"));
        } else {
            innerProperties().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(CustomImageInner.class);
}
