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

package com.azure.resourcemanager.databox.models;

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

/** Request to validate preference of transport and data center. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "validationType")
@JsonTypeName("ValidatePreferences")
@Fluent
public final class PreferencesValidationRequest extends ValidationInputRequest {
    /*
     * Preference of transport and data center.
     */
    @JsonProperty(value = "preference")
    private Preferences preference;

    /*
     * Device type to be used for the job.
     */
    @JsonProperty(value = "deviceType", required = true)
    private SkuName deviceType;

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

    /**
     * Get the preference property: Preference of transport and data center.
     *
     * @return the preference value.
     */
    public Preferences preference() {
        return this.preference;
    }

    /**
     * Set the preference property: Preference of transport and data center.
     *
     * @param preference the preference value to set.
     * @return the PreferencesValidationRequest object itself.
     */
    public PreferencesValidationRequest withPreference(Preferences preference) {
        this.preference = preference;
        return this;
    }

    /**
     * Get the deviceType property: Device type to be used for the job.
     *
     * @return the deviceType value.
     */
    public SkuName deviceType() {
        return this.deviceType;
    }

    /**
     * Set the deviceType property: Device type to be used for the job.
     *
     * @param deviceType the deviceType value to set.
     * @return the PreferencesValidationRequest object itself.
     */
    public PreferencesValidationRequest withDeviceType(SkuName deviceType) {
        this.deviceType = deviceType;
        return this;
    }

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

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