// 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.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.resourcemanager.appcontainers.models.ReplicaContainer;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** Container App Revision Replica. */
@Fluent
public final class ReplicaInner extends ProxyResource {
    /*
     * Replica resource specific properties
     */
    @JsonProperty(value = "properties")
    private ReplicaProperties 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 ReplicaInner class. */
    public ReplicaInner() {
    }

    /**
     * Get the innerProperties property: Replica resource specific properties.
     *
     * @return the innerProperties value.
     */
    private ReplicaProperties 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;
    }

    /**
     * Get the createdTime property: Timestamp describing when the pod was created by controller.
     *
     * @return the createdTime value.
     */
    public OffsetDateTime createdTime() {
        return this.innerProperties() == null ? null : this.innerProperties().createdTime();
    }

    /**
     * Get the containers property: The containers collection under a replica.
     *
     * @return the containers value.
     */
    public List<ReplicaContainer> containers() {
        return this.innerProperties() == null ? null : this.innerProperties().containers();
    }

    /**
     * Set the containers property: The containers collection under a replica.
     *
     * @param containers the containers value to set.
     * @return the ReplicaInner object itself.
     */
    public ReplicaInner withContainers(List<ReplicaContainer> containers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReplicaProperties();
        }
        this.innerProperties().withContainers(containers);
        return this;
    }

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