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

package com.azure.resourcemanager.machinelearning.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.machinelearning.models.BatchEndpointProperties;
import com.azure.resourcemanager.machinelearning.models.ManagedServiceIdentity;
import com.azure.resourcemanager.machinelearning.models.Sku;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** The BatchEndpoint model. */
@Fluent
public final class BatchEndpointInner extends Resource {
    /*
     * Managed service identity (system assigned and/or user assigned identities)
     */
    @JsonProperty(value = "identity")
    private ManagedServiceIdentity identity;

    /*
     * Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type.
     */
    @JsonProperty(value = "kind")
    private String kind;

    /*
     * [Required] Additional attributes of the entity.
     */
    @JsonProperty(value = "properties", required = true)
    private BatchEndpointProperties properties;

    /*
     * Sku details required for ARM contract for Autoscaling.
     */
    @JsonProperty(value = "sku")
    private Sku sku;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

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

    /**
     * Get the identity property: Managed service identity (system assigned and/or user assigned identities).
     *
     * @return the identity value.
     */
    public ManagedServiceIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: Managed service identity (system assigned and/or user assigned identities).
     *
     * @param identity the identity value to set.
     * @return the BatchEndpointInner object itself.
     */
    public BatchEndpointInner withIdentity(ManagedServiceIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of
     * the same type.
     *
     * @return the kind value.
     */
    public String kind() {
        return this.kind;
    }

    /**
     * Set the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of
     * the same type.
     *
     * @param kind the kind value to set.
     * @return the BatchEndpointInner object itself.
     */
    public BatchEndpointInner withKind(String kind) {
        this.kind = kind;
        return this;
    }

    /**
     * Get the properties property: [Required] Additional attributes of the entity.
     *
     * @return the properties value.
     */
    public BatchEndpointProperties properties() {
        return this.properties;
    }

    /**
     * Set the properties property: [Required] Additional attributes of the entity.
     *
     * @param properties the properties value to set.
     * @return the BatchEndpointInner object itself.
     */
    public BatchEndpointInner withProperties(BatchEndpointProperties properties) {
        this.properties = properties;
        return this;
    }

    /**
     * Get the sku property: Sku details required for ARM contract for Autoscaling.
     *
     * @return the sku value.
     */
    public Sku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: Sku details required for ARM contract for Autoscaling.
     *
     * @param sku the sku value to set.
     * @return the BatchEndpointInner object itself.
     */
    public BatchEndpointInner withSku(Sku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

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

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

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

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