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

package com.azure.resourcemanager.imagebuilder.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Purchase plan configuration for platform image. */
@Fluent
public final class PlatformImagePurchasePlan {
    /*
     * Name of the purchase plan.
     */
    @JsonProperty(value = "planName", required = true)
    private String planName;

    /*
     * Product of the purchase plan.
     */
    @JsonProperty(value = "planProduct", required = true)
    private String planProduct;

    /*
     * Publisher of the purchase plan.
     */
    @JsonProperty(value = "planPublisher", required = true)
    private String planPublisher;

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

    /**
     * Get the planName property: Name of the purchase plan.
     *
     * @return the planName value.
     */
    public String planName() {
        return this.planName;
    }

    /**
     * Set the planName property: Name of the purchase plan.
     *
     * @param planName the planName value to set.
     * @return the PlatformImagePurchasePlan object itself.
     */
    public PlatformImagePurchasePlan withPlanName(String planName) {
        this.planName = planName;
        return this;
    }

    /**
     * Get the planProduct property: Product of the purchase plan.
     *
     * @return the planProduct value.
     */
    public String planProduct() {
        return this.planProduct;
    }

    /**
     * Set the planProduct property: Product of the purchase plan.
     *
     * @param planProduct the planProduct value to set.
     * @return the PlatformImagePurchasePlan object itself.
     */
    public PlatformImagePurchasePlan withPlanProduct(String planProduct) {
        this.planProduct = planProduct;
        return this;
    }

    /**
     * Get the planPublisher property: Publisher of the purchase plan.
     *
     * @return the planPublisher value.
     */
    public String planPublisher() {
        return this.planPublisher;
    }

    /**
     * Set the planPublisher property: Publisher of the purchase plan.
     *
     * @param planPublisher the planPublisher value to set.
     * @return the PlatformImagePurchasePlan object itself.
     */
    public PlatformImagePurchasePlan withPlanPublisher(String planPublisher) {
        this.planPublisher = planPublisher;
        return this;
    }

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

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