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

package com.azure.resourcemanager.machinelearningservices.models;

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

/** The base class for creating a service. */
@JsonTypeInfo(
    use = JsonTypeInfo.Id.NAME,
    include = JsonTypeInfo.As.PROPERTY,
    property = "computeType",
    defaultImpl = CreateServiceRequest.class)
@JsonTypeName("CreateServiceRequest")
@JsonSubTypes({
    @JsonSubTypes.Type(name = "ACI", value = AciServiceCreateRequest.class),
    @JsonSubTypes.Type(name = "Custom", value = CreateEndpointVariantRequest.class)
})
@Fluent
public class CreateServiceRequest {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(CreateServiceRequest.class);

    /*
     * The description of the service.
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * The service tag dictionary. Tags are mutable.
     */
    @JsonProperty(value = "kvTags")
    private Map<String, String> kvTags;

    /*
     * The service properties dictionary. Properties are immutable.
     */
    @JsonProperty(value = "properties")
    private Map<String, String> properties;

    /*
     * The authentication keys.
     */
    @JsonProperty(value = "keys")
    private CreateServiceRequestKeys keys;

    /*
     * The Environment, models and assets needed for inferencing.
     */
    @JsonProperty(value = "environmentImageRequest")
    private CreateServiceRequestEnvironmentImageRequest environmentImageRequest;

    /*
     * The name of the Azure location/region.
     */
    @JsonProperty(value = "location")
    private String location;

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

    /**
     * Set the description property: The description of the service.
     *
     * @param description the description value to set.
     * @return the CreateServiceRequest object itself.
     */
    public CreateServiceRequest withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the kvTags property: The service tag dictionary. Tags are mutable.
     *
     * @return the kvTags value.
     */
    public Map<String, String> kvTags() {
        return this.kvTags;
    }

    /**
     * Set the kvTags property: The service tag dictionary. Tags are mutable.
     *
     * @param kvTags the kvTags value to set.
     * @return the CreateServiceRequest object itself.
     */
    public CreateServiceRequest withKvTags(Map<String, String> kvTags) {
        this.kvTags = kvTags;
        return this;
    }

    /**
     * Get the properties property: The service properties dictionary. Properties are immutable.
     *
     * @return the properties value.
     */
    public Map<String, String> properties() {
        return this.properties;
    }

    /**
     * Set the properties property: The service properties dictionary. Properties are immutable.
     *
     * @param properties the properties value to set.
     * @return the CreateServiceRequest object itself.
     */
    public CreateServiceRequest withProperties(Map<String, String> properties) {
        this.properties = properties;
        return this;
    }

    /**
     * Get the keys property: The authentication keys.
     *
     * @return the keys value.
     */
    public CreateServiceRequestKeys keys() {
        return this.keys;
    }

    /**
     * Set the keys property: The authentication keys.
     *
     * @param keys the keys value to set.
     * @return the CreateServiceRequest object itself.
     */
    public CreateServiceRequest withKeys(CreateServiceRequestKeys keys) {
        this.keys = keys;
        return this;
    }

    /**
     * Get the environmentImageRequest property: The Environment, models and assets needed for inferencing.
     *
     * @return the environmentImageRequest value.
     */
    public CreateServiceRequestEnvironmentImageRequest environmentImageRequest() {
        return this.environmentImageRequest;
    }

    /**
     * Set the environmentImageRequest property: The Environment, models and assets needed for inferencing.
     *
     * @param environmentImageRequest the environmentImageRequest value to set.
     * @return the CreateServiceRequest object itself.
     */
    public CreateServiceRequest withEnvironmentImageRequest(
        CreateServiceRequestEnvironmentImageRequest environmentImageRequest) {
        this.environmentImageRequest = environmentImageRequest;
        return this;
    }

    /**
     * Get the location property: The name of the Azure location/region.
     *
     * @return the location value.
     */
    public String location() {
        return this.location;
    }

    /**
     * Set the location property: The name of the Azure location/region.
     *
     * @param location the location value to set.
     * @return the CreateServiceRequest object itself.
     */
    public CreateServiceRequest withLocation(String location) {
        this.location = location;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (keys() != null) {
            keys().validate();
        }
        if (environmentImageRequest() != null) {
            environmentImageRequest().validate();
        }
    }
}
