// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** The resource representation of a service in a service topology. */
@Fluent
public final class ServiceResourceInner extends Resource {
    /*
     * The properties that define a service in a service topology.
     */
    @JsonProperty(value = "properties", required = true)
    private ServiceResourceProperties innerProperties = new ServiceResourceProperties();

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

    /**
     * Get the innerProperties property: The properties that define a service in a service topology.
     *
     * @return the innerProperties value.
     */
    private ServiceResourceProperties innerProperties() {
        return this.innerProperties;
    }

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

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

    /**
     * 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.innerProperties() == null ? null : this.innerProperties().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 ServiceResourceInner object itself.
     */
    public ServiceResourceInner withTargetLocation(String targetLocation) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ServiceResourceProperties();
        }
        this.innerProperties().withTargetLocation(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.innerProperties() == null ? null : this.innerProperties().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 ServiceResourceInner object itself.
     */
    public ServiceResourceInner withTargetSubscriptionId(String targetSubscriptionId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ServiceResourceProperties();
        }
        this.innerProperties().withTargetSubscriptionId(targetSubscriptionId);
        return this;
    }

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

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