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

package com.azure.resourcemanager.networkcloud.models;

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

/** VirtualMachinePlacementHint represents a single scheduling hint of the virtual machine. */
@Fluent
public final class VirtualMachinePlacementHint {
    /*
     * The specification of whether this hint supports affinity or anti-affinity with the referenced resources.
     */
    @JsonProperty(value = "hintType", required = true)
    private VirtualMachinePlacementHintType hintType;

    /*
     * The resource ID of the target object that the placement hints will be checked against, e.g., the bare metal node
     * to host the virtual machine.
     */
    @JsonProperty(value = "resourceId", required = true)
    private String resourceId;

    /*
     * The indicator of whether the hint is a hard or soft requirement during scheduling.
     */
    @JsonProperty(value = "schedulingExecution", required = true)
    private VirtualMachineSchedulingExecution schedulingExecution;

    /*
     * The scope for the virtual machine affinity or anti-affinity placement hint. It should always be "Machine" in the
     * case of node affinity.
     */
    @JsonProperty(value = "scope", required = true)
    private VirtualMachinePlacementHintPodAffinityScope scope;

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

    /**
     * Get the hintType property: The specification of whether this hint supports affinity or anti-affinity with the
     * referenced resources.
     *
     * @return the hintType value.
     */
    public VirtualMachinePlacementHintType hintType() {
        return this.hintType;
    }

    /**
     * Set the hintType property: The specification of whether this hint supports affinity or anti-affinity with the
     * referenced resources.
     *
     * @param hintType the hintType value to set.
     * @return the VirtualMachinePlacementHint object itself.
     */
    public VirtualMachinePlacementHint withHintType(VirtualMachinePlacementHintType hintType) {
        this.hintType = hintType;
        return this;
    }

    /**
     * Get the resourceId property: The resource ID of the target object that the placement hints will be checked
     * against, e.g., the bare metal node to host the virtual machine.
     *
     * @return the resourceId value.
     */
    public String resourceId() {
        return this.resourceId;
    }

    /**
     * Set the resourceId property: The resource ID of the target object that the placement hints will be checked
     * against, e.g., the bare metal node to host the virtual machine.
     *
     * @param resourceId the resourceId value to set.
     * @return the VirtualMachinePlacementHint object itself.
     */
    public VirtualMachinePlacementHint withResourceId(String resourceId) {
        this.resourceId = resourceId;
        return this;
    }

    /**
     * Get the schedulingExecution property: The indicator of whether the hint is a hard or soft requirement during
     * scheduling.
     *
     * @return the schedulingExecution value.
     */
    public VirtualMachineSchedulingExecution schedulingExecution() {
        return this.schedulingExecution;
    }

    /**
     * Set the schedulingExecution property: The indicator of whether the hint is a hard or soft requirement during
     * scheduling.
     *
     * @param schedulingExecution the schedulingExecution value to set.
     * @return the VirtualMachinePlacementHint object itself.
     */
    public VirtualMachinePlacementHint withSchedulingExecution(VirtualMachineSchedulingExecution schedulingExecution) {
        this.schedulingExecution = schedulingExecution;
        return this;
    }

    /**
     * Get the scope property: The scope for the virtual machine affinity or anti-affinity placement hint. It should
     * always be "Machine" in the case of node affinity.
     *
     * @return the scope value.
     */
    public VirtualMachinePlacementHintPodAffinityScope scope() {
        return this.scope;
    }

    /**
     * Set the scope property: The scope for the virtual machine affinity or anti-affinity placement hint. It should
     * always be "Machine" in the case of node affinity.
     *
     * @param scope the scope value to set.
     * @return the VirtualMachinePlacementHint object itself.
     */
    public VirtualMachinePlacementHint withScope(VirtualMachinePlacementHintPodAffinityScope scope) {
        this.scope = scope;
        return this;
    }

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

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