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

package com.azure.resourcemanager.machinelearning.models;

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

/** Configuration for a scoring code asset. */
@Fluent
public final class CodeConfiguration {
    /*
     * ARM resource ID of the code asset.
     */
    @JsonProperty(value = "codeId")
    private String codeId;

    /*
     * [Required] The script to execute on startup. eg. "score.py"
     */
    @JsonProperty(value = "scoringScript", required = true)
    private String scoringScript;

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

    /**
     * Get the codeId property: ARM resource ID of the code asset.
     *
     * @return the codeId value.
     */
    public String codeId() {
        return this.codeId;
    }

    /**
     * Set the codeId property: ARM resource ID of the code asset.
     *
     * @param codeId the codeId value to set.
     * @return the CodeConfiguration object itself.
     */
    public CodeConfiguration withCodeId(String codeId) {
        this.codeId = codeId;
        return this;
    }

    /**
     * Get the scoringScript property: [Required] The script to execute on startup. eg. "score.py".
     *
     * @return the scoringScript value.
     */
    public String scoringScript() {
        return this.scoringScript;
    }

    /**
     * Set the scoringScript property: [Required] The script to execute on startup. eg. "score.py".
     *
     * @param scoringScript the scoringScript value to set.
     * @return the CodeConfiguration object itself.
     */
    public CodeConfiguration withScoringScript(String scoringScript) {
        this.scoringScript = scoringScript;
        return this;
    }

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

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