// 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.GalleryImageReference;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

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

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

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

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

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

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

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

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

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

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

    /**
     * Get the imageReference property: The image reference of the gallery image.
     *
     * @return the imageReference value.
     */
    public GalleryImageReference imageReference() {
        return this.innerProperties() == null ? null : this.innerProperties().imageReference();
    }

    /**
     * Set the imageReference property: The image reference of the gallery image.
     *
     * @param imageReference the imageReference value to set.
     * @return the GalleryImageInner object itself.
     */
    public GalleryImageInner withImageReference(GalleryImageReference imageReference) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GalleryImageProperties();
        }
        this.innerProperties().withImageReference(imageReference);
        return this;
    }

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

    /**
     * Set the icon property: The icon of the gallery image.
     *
     * @param icon the icon value to set.
     * @return the GalleryImageInner object itself.
     */
    public GalleryImageInner withIcon(String icon) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GalleryImageProperties();
        }
        this.innerProperties().withIcon(icon);
        return this;
    }

    /**
     * Get the enabled property: Indicates whether this gallery image is enabled.
     *
     * @return the enabled value.
     */
    public Boolean enabled() {
        return this.innerProperties() == null ? null : this.innerProperties().enabled();
    }

    /**
     * Set the enabled property: Indicates whether this gallery image is enabled.
     *
     * @param enabled the enabled value to set.
     * @return the GalleryImageInner object itself.
     */
    public GalleryImageInner withEnabled(Boolean enabled) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GalleryImageProperties();
        }
        this.innerProperties().withEnabled(enabled);
        return this;
    }

    /**
     * Get the planId property: The third party plan that applies to this image.
     *
     * @return the planId value.
     */
    public String planId() {
        return this.innerProperties() == null ? null : this.innerProperties().planId();
    }

    /**
     * Set the planId property: The third party plan that applies to this image.
     *
     * @param planId the planId value to set.
     * @return the GalleryImageInner object itself.
     */
    public GalleryImageInner withPlanId(String planId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GalleryImageProperties();
        }
        this.innerProperties().withPlanId(planId);
        return this;
    }

    /**
     * Get the isPlanAuthorized property: Indicates if the plan has been authorized for programmatic deployment.
     *
     * @return the isPlanAuthorized value.
     */
    public Boolean isPlanAuthorized() {
        return this.innerProperties() == null ? null : this.innerProperties().isPlanAuthorized();
    }

    /**
     * Set the isPlanAuthorized property: Indicates if the plan has been authorized for programmatic deployment.
     *
     * @param isPlanAuthorized the isPlanAuthorized value to set.
     * @return the GalleryImageInner object itself.
     */
    public GalleryImageInner withIsPlanAuthorized(Boolean isPlanAuthorized) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GalleryImageProperties();
        }
        this.innerProperties().withIsPlanAuthorized(isPlanAuthorized);
        return this;
    }

    /**
     * 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 GalleryImageInner"));
        } else {
            innerProperties().validate();
        }
    }

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