// 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.util.logging.ClientLogger;
import com.azure.resourcemanager.machinelearning.models.EndpointAuthMode;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Inference Endpoint base definition. */
@Fluent
public class EndpointPropertiesBaseInner {
    /*
     * [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure Machine Learning token-based
     * authentication. 'Key' doesn't expire but 'AMLToken' does.
     */
    @JsonProperty(value = "authMode", required = true)
    private EndpointAuthMode authMode;

    /*
     * Description of the inference endpoint.
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * EndpointAuthKeys to set initially on an Endpoint.
     * This property will always be returned as null. AuthKey values must be retrieved using the ListKeys API.
     */
    @JsonProperty(value = "keys")
    private EndpointAuthKeysInner keys;

    /*
     * Property dictionary. Properties can be added, but not removed or altered.
     */
    @JsonProperty(value = "properties")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> properties;

    /*
     * Endpoint URI.
     */
    @JsonProperty(value = "scoringUri", access = JsonProperty.Access.WRITE_ONLY)
    private String scoringUri;

    /*
     * Endpoint Swagger URI.
     */
    @JsonProperty(value = "swaggerUri", access = JsonProperty.Access.WRITE_ONLY)
    private String swaggerUri;

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

    /**
     * Get the authMode property: [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure Machine
     * Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does.
     *
     * @return the authMode value.
     */
    public EndpointAuthMode authMode() {
        return this.authMode;
    }

    /**
     * Set the authMode property: [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure Machine
     * Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does.
     *
     * @param authMode the authMode value to set.
     * @return the EndpointPropertiesBaseInner object itself.
     */
    public EndpointPropertiesBaseInner withAuthMode(EndpointAuthMode authMode) {
        this.authMode = authMode;
        return this;
    }

    /**
     * Get the description property: Description of the inference endpoint.
     *
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: Description of the inference endpoint.
     *
     * @param description the description value to set.
     * @return the EndpointPropertiesBaseInner object itself.
     */
    public EndpointPropertiesBaseInner withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the keys property: EndpointAuthKeys to set initially on an Endpoint. This property will always be returned as
     * null. AuthKey values must be retrieved using the ListKeys API.
     *
     * @return the keys value.
     */
    public EndpointAuthKeysInner keys() {
        return this.keys;
    }

    /**
     * Set the keys property: EndpointAuthKeys to set initially on an Endpoint. This property will always be returned as
     * null. AuthKey values must be retrieved using the ListKeys API.
     *
     * @param keys the keys value to set.
     * @return the EndpointPropertiesBaseInner object itself.
     */
    public EndpointPropertiesBaseInner withKeys(EndpointAuthKeysInner keys) {
        this.keys = keys;
        return this;
    }

    /**
     * Get the properties property: Property dictionary. Properties can be added, but not removed or altered.
     *
     * @return the properties value.
     */
    public Map<String, String> properties() {
        return this.properties;
    }

    /**
     * Set the properties property: Property dictionary. Properties can be added, but not removed or altered.
     *
     * @param properties the properties value to set.
     * @return the EndpointPropertiesBaseInner object itself.
     */
    public EndpointPropertiesBaseInner withProperties(Map<String, String> properties) {
        this.properties = properties;
        return this;
    }

    /**
     * Get the scoringUri property: Endpoint URI.
     *
     * @return the scoringUri value.
     */
    public String scoringUri() {
        return this.scoringUri;
    }

    /**
     * Get the swaggerUri property: Endpoint Swagger URI.
     *
     * @return the swaggerUri value.
     */
    public String swaggerUri() {
        return this.swaggerUri;
    }

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

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