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

package com.azure.resourcemanager.batchai.models;

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

/** Docker container settings. */
@Fluent
public final class ContainerSettings {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerSettings.class);

    /*
     * Information about docker image and docker registry to download the
     * container from.
     */
    @JsonProperty(value = "imageSourceRegistry", required = true)
    private ImageSourceRegistry imageSourceRegistry;

    /*
     * Size of /dev/shm. Please refer to docker documentation for supported
     * argument formats.
     */
    @JsonProperty(value = "shmSize")
    private String shmSize;

    /**
     * Get the imageSourceRegistry property: Information about docker image and docker registry to download the
     * container from.
     *
     * @return the imageSourceRegistry value.
     */
    public ImageSourceRegistry imageSourceRegistry() {
        return this.imageSourceRegistry;
    }

    /**
     * Set the imageSourceRegistry property: Information about docker image and docker registry to download the
     * container from.
     *
     * @param imageSourceRegistry the imageSourceRegistry value to set.
     * @return the ContainerSettings object itself.
     */
    public ContainerSettings withImageSourceRegistry(ImageSourceRegistry imageSourceRegistry) {
        this.imageSourceRegistry = imageSourceRegistry;
        return this;
    }

    /**
     * Get the shmSize property: Size of /dev/shm. Please refer to docker documentation for supported argument formats.
     *
     * @return the shmSize value.
     */
    public String shmSize() {
        return this.shmSize;
    }

    /**
     * Set the shmSize property: Size of /dev/shm. Please refer to docker documentation for supported argument formats.
     *
     * @param shmSize the shmSize value to set.
     * @return the ContainerSettings object itself.
     */
    public ContainerSettings withShmSize(String shmSize) {
        this.shmSize = shmSize;
        return this;
    }

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