// 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.resourcemanager.appcontainers.models.JobExecutionRunningState;
import com.azure.resourcemanager.appcontainers.models.JobExecutionTemplate;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Container Apps Jobs execution. */
@Fluent
public final class JobExecutionInner {
    /*
     * Job execution Name.
     */
    @JsonProperty(value = "name")
    private String name;

    /*
     * Job execution Id.
     */
    @JsonProperty(value = "id")
    private String id;

    /*
     * Job Type.
     */
    @JsonProperty(value = "type")
    private String type;

    /*
     * Current running State of the job
     */
    @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
    private JobExecutionRunningState status;

    /*
     * Job execution start time.
     */
    @JsonProperty(value = "startTime")
    private OffsetDateTime startTime;

    /*
     * Job execution start time.
     */
    @JsonProperty(value = "endTime")
    private OffsetDateTime endTime;

    /*
     * Job's execution container.
     */
    @JsonProperty(value = "template")
    private JobExecutionTemplate template;

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

    /**
     * Get the name property: Job execution Name.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Job execution Name.
     *
     * @param name the name value to set.
     * @return the JobExecutionInner object itself.
     */
    public JobExecutionInner withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the id property: Job execution Id.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Set the id property: Job execution Id.
     *
     * @param id the id value to set.
     * @return the JobExecutionInner object itself.
     */
    public JobExecutionInner withId(String id) {
        this.id = id;
        return this;
    }

    /**
     * Get the type property: Job Type.
     *
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Set the type property: Job Type.
     *
     * @param type the type value to set.
     * @return the JobExecutionInner object itself.
     */
    public JobExecutionInner withType(String type) {
        this.type = type;
        return this;
    }

    /**
     * Get the status property: Current running State of the job.
     *
     * @return the status value.
     */
    public JobExecutionRunningState status() {
        return this.status;
    }

    /**
     * Get the startTime property: Job execution start time.
     *
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.startTime;
    }

    /**
     * Set the startTime property: Job execution start time.
     *
     * @param startTime the startTime value to set.
     * @return the JobExecutionInner object itself.
     */
    public JobExecutionInner withStartTime(OffsetDateTime startTime) {
        this.startTime = startTime;
        return this;
    }

    /**
     * Get the endTime property: Job execution start time.
     *
     * @return the endTime value.
     */
    public OffsetDateTime endTime() {
        return this.endTime;
    }

    /**
     * Set the endTime property: Job execution start time.
     *
     * @param endTime the endTime value to set.
     * @return the JobExecutionInner object itself.
     */
    public JobExecutionInner withEndTime(OffsetDateTime endTime) {
        this.endTime = endTime;
        return this;
    }

    /**
     * Get the template property: Job's execution container.
     *
     * @return the template value.
     */
    public JobExecutionTemplate template() {
        return this.template;
    }

    /**
     * Set the template property: Job's execution container.
     *
     * @param template the template value to set.
     * @return the JobExecutionInner object itself.
     */
    public JobExecutionInner withTemplate(JobExecutionTemplate template) {
        this.template = template;
        return this;
    }

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