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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.resourcemanager.appcontainers.models.JobConfiguration;
import com.azure.resourcemanager.appcontainers.models.JobProvisioningState;
import com.azure.resourcemanager.appcontainers.models.JobTemplate;
import com.azure.resourcemanager.appcontainers.models.ManagedServiceIdentity;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Container App Job. */
@Fluent
public final class JobInner extends Resource {
    /*
     * Managed identities needed by a container app job to interact with other Azure services to not maintain any
     * secrets or credentials in code.
     */
    @JsonProperty(value = "identity")
    private ManagedServiceIdentity identity;

    /*
     * Container Apps Job resource specific properties.
     */
    @JsonProperty(value = "properties")
    private JobProperties innerProperties;

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

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

    /**
     * Get the identity property: Managed identities needed by a container app job to interact with other Azure services
     * to not maintain any secrets or credentials in code.
     *
     * @return the identity value.
     */
    public ManagedServiceIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: Managed identities needed by a container app job to interact with other Azure services
     * to not maintain any secrets or credentials in code.
     *
     * @param identity the identity value to set.
     * @return the JobInner object itself.
     */
    public JobInner withIdentity(ManagedServiceIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the innerProperties property: Container Apps Job resource specific properties.
     *
     * @return the innerProperties value.
     */
    private JobProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * 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 JobInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

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

    /**
     * Get the provisioningState property: Provisioning state of the Container Apps Job.
     *
     * @return the provisioningState value.
     */
    public JobProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the environmentId property: Resource ID of environment.
     *
     * @return the environmentId value.
     */
    public String environmentId() {
        return this.innerProperties() == null ? null : this.innerProperties().environmentId();
    }

    /**
     * Set the environmentId property: Resource ID of environment.
     *
     * @param environmentId the environmentId value to set.
     * @return the JobInner object itself.
     */
    public JobInner withEnvironmentId(String environmentId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withEnvironmentId(environmentId);
        return this;
    }

    /**
     * Get the workloadProfileName property: Workload profile name to pin for container apps job execution.
     *
     * @return the workloadProfileName value.
     */
    public String workloadProfileName() {
        return this.innerProperties() == null ? null : this.innerProperties().workloadProfileName();
    }

    /**
     * Set the workloadProfileName property: Workload profile name to pin for container apps job execution.
     *
     * @param workloadProfileName the workloadProfileName value to set.
     * @return the JobInner object itself.
     */
    public JobInner withWorkloadProfileName(String workloadProfileName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withWorkloadProfileName(workloadProfileName);
        return this;
    }

    /**
     * Get the configuration property: Container Apps Job configuration properties.
     *
     * @return the configuration value.
     */
    public JobConfiguration configuration() {
        return this.innerProperties() == null ? null : this.innerProperties().configuration();
    }

    /**
     * Set the configuration property: Container Apps Job configuration properties.
     *
     * @param configuration the configuration value to set.
     * @return the JobInner object itself.
     */
    public JobInner withConfiguration(JobConfiguration configuration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withConfiguration(configuration);
        return this;
    }

    /**
     * Get the template property: Container Apps job definition.
     *
     * @return the template value.
     */
    public JobTemplate template() {
        return this.innerProperties() == null ? null : this.innerProperties().template();
    }

    /**
     * Set the template property: Container Apps job definition.
     *
     * @param template the template value to set.
     * @return the JobInner object itself.
     */
    public JobInner withTemplate(JobTemplate template) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withTemplate(template);
        return this;
    }

    /**
     * Get the outboundIpAddresses property: Outbound IP Addresses of a container apps job.
     *
     * @return the outboundIpAddresses value.
     */
    public List<String> outboundIpAddresses() {
        return this.innerProperties() == null ? null : this.innerProperties().outboundIpAddresses();
    }

    /**
     * Get the eventStreamEndpoint property: The endpoint of the eventstream of the container apps job.
     *
     * @return the eventStreamEndpoint value.
     */
    public String eventStreamEndpoint() {
        return this.innerProperties() == null ? null : this.innerProperties().eventStreamEndpoint();
    }

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