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

package com.azure.resourcemanager.dataprotection.models;

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

/**
 * PolicyInfo
 *
 * <p>Policy Info in backupInstance.
 */
@Fluent
public final class PolicyInfo {
    /*
     * The policyId property.
     */
    @JsonProperty(value = "policyId", required = true)
    private String policyId;

    /*
     * The policyVersion property.
     */
    @JsonProperty(value = "policyVersion", access = JsonProperty.Access.WRITE_ONLY)
    private String policyVersion;

    /*
     * Policy parameters for the backup instance
     */
    @JsonProperty(value = "policyParameters")
    private PolicyParameters policyParameters;

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

    /**
     * Get the policyId property: The policyId property.
     *
     * @return the policyId value.
     */
    public String policyId() {
        return this.policyId;
    }

    /**
     * Set the policyId property: The policyId property.
     *
     * @param policyId the policyId value to set.
     * @return the PolicyInfo object itself.
     */
    public PolicyInfo withPolicyId(String policyId) {
        this.policyId = policyId;
        return this;
    }

    /**
     * Get the policyVersion property: The policyVersion property.
     *
     * @return the policyVersion value.
     */
    public String policyVersion() {
        return this.policyVersion;
    }

    /**
     * Get the policyParameters property: Policy parameters for the backup instance.
     *
     * @return the policyParameters value.
     */
    public PolicyParameters policyParameters() {
        return this.policyParameters;
    }

    /**
     * Set the policyParameters property: Policy parameters for the backup instance.
     *
     * @param policyParameters the policyParameters value to set.
     * @return the PolicyInfo object itself.
     */
    public PolicyInfo withPolicyParameters(PolicyParameters policyParameters) {
        this.policyParameters = policyParameters;
        return this;
    }

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

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