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

package com.azure.resourcemanager.deploymentmanager.models;

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

/** The properties of a service. */
@Fluent
public class ServiceProperties {
    /*
     * The Azure location to which the resources in the service belong to or should be deployed to.
     */
    @JsonProperty(value = "targetLocation", required = true)
    private String targetLocation;

    /*
     * The subscription to which the resources in the service belong to or should be deployed to.
     */
    @JsonProperty(value = "targetSubscriptionId", required = true)
    private String targetSubscriptionId;

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

    /**
     * Get the targetLocation property: The Azure location to which the resources in the service belong to or should be
     * deployed to.
     *
     * @return the targetLocation value.
     */
    public String targetLocation() {
        return this.targetLocation;
    }

    /**
     * Set the targetLocation property: The Azure location to which the resources in the service belong to or should be
     * deployed to.
     *
     * @param targetLocation the targetLocation value to set.
     * @return the ServiceProperties object itself.
     */
    public ServiceProperties withTargetLocation(String targetLocation) {
        this.targetLocation = targetLocation;
        return this;
    }

    /**
     * Get the targetSubscriptionId property: The subscription to which the resources in the service belong to or should
     * be deployed to.
     *
     * @return the targetSubscriptionId value.
     */
    public String targetSubscriptionId() {
        return this.targetSubscriptionId;
    }

    /**
     * Set the targetSubscriptionId property: The subscription to which the resources in the service belong to or should
     * be deployed to.
     *
     * @param targetSubscriptionId the targetSubscriptionId value to set.
     * @return the ServiceProperties object itself.
     */
    public ServiceProperties withTargetSubscriptionId(String targetSubscriptionId) {
        this.targetSubscriptionId = targetSubscriptionId;
        return this;
    }

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

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