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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.education.models.LabStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Lab detail result properties. */
@Fluent
public final class LabProperties {
    /*
     * Lab Display Name
     */
    @JsonProperty(value = "displayName", required = true)
    private String displayName;

    /*
     * Default monetary cap for each student in this lab
     */
    @JsonProperty(value = "budgetPerStudent", required = true)
    private Amount budgetPerStudent;

    /*
     * Detail description of this lab
     */
    @JsonProperty(value = "description", required = true)
    private String description;

    /*
     * Default expiration date for each student in this lab
     */
    @JsonProperty(value = "expirationDate", required = true)
    private OffsetDateTime expirationDate;

    /*
     * Lab creation date
     */
    @JsonProperty(value = "effectiveDate", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime effectiveDate;

    /*
     * The status of this lab
     */
    @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
    private LabStatus status;

    /*
     * the total number of students that can be accepted to the lab.
     */
    @JsonProperty(value = "maxStudentCount", access = JsonProperty.Access.WRITE_ONLY)
    private Float maxStudentCount;

    /*
     * invitation code for redeemable lab
     */
    @JsonProperty(value = "invitationCode", access = JsonProperty.Access.WRITE_ONLY)
    private String invitationCode;

    /*
     * Total budget
     */
    @JsonProperty(value = "totalBudget", access = JsonProperty.Access.WRITE_ONLY)
    private Amount innerTotalBudget;

    /*
     * Total allocated budget
     */
    @JsonProperty(value = "totalAllocatedBudget", access = JsonProperty.Access.WRITE_ONLY)
    private Amount innerTotalAllocatedBudget;

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

    /**
     * Get the displayName property: Lab Display Name.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: Lab Display Name.
     *
     * @param displayName the displayName value to set.
     * @return the LabProperties object itself.
     */
    public LabProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the budgetPerStudent property: Default monetary cap for each student in this lab.
     *
     * @return the budgetPerStudent value.
     */
    public Amount budgetPerStudent() {
        return this.budgetPerStudent;
    }

    /**
     * Set the budgetPerStudent property: Default monetary cap for each student in this lab.
     *
     * @param budgetPerStudent the budgetPerStudent value to set.
     * @return the LabProperties object itself.
     */
    public LabProperties withBudgetPerStudent(Amount budgetPerStudent) {
        this.budgetPerStudent = budgetPerStudent;
        return this;
    }

    /**
     * Get the description property: Detail description of this lab.
     *
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: Detail description of this lab.
     *
     * @param description the description value to set.
     * @return the LabProperties object itself.
     */
    public LabProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the expirationDate property: Default expiration date for each student in this lab.
     *
     * @return the expirationDate value.
     */
    public OffsetDateTime expirationDate() {
        return this.expirationDate;
    }

    /**
     * Set the expirationDate property: Default expiration date for each student in this lab.
     *
     * @param expirationDate the expirationDate value to set.
     * @return the LabProperties object itself.
     */
    public LabProperties withExpirationDate(OffsetDateTime expirationDate) {
        this.expirationDate = expirationDate;
        return this;
    }

    /**
     * Get the effectiveDate property: Lab creation date.
     *
     * @return the effectiveDate value.
     */
    public OffsetDateTime effectiveDate() {
        return this.effectiveDate;
    }

    /**
     * Get the status property: The status of this lab.
     *
     * @return the status value.
     */
    public LabStatus status() {
        return this.status;
    }

    /**
     * Get the maxStudentCount property: the total number of students that can be accepted to the lab.
     *
     * @return the maxStudentCount value.
     */
    public Float maxStudentCount() {
        return this.maxStudentCount;
    }

    /**
     * Get the invitationCode property: invitation code for redeemable lab.
     *
     * @return the invitationCode value.
     */
    public String invitationCode() {
        return this.invitationCode;
    }

    /**
     * Get the innerTotalBudget property: Total budget.
     *
     * @return the innerTotalBudget value.
     */
    private Amount innerTotalBudget() {
        return this.innerTotalBudget;
    }

    /**
     * Get the innerTotalAllocatedBudget property: Total allocated budget.
     *
     * @return the innerTotalAllocatedBudget value.
     */
    private Amount innerTotalAllocatedBudget() {
        return this.innerTotalAllocatedBudget;
    }

    /**
     * Get the currency property: The type of currency being used for the value.
     *
     * @return the currency value.
     */
    public String currency() {
        return this.innerTotalBudget() == null ? null : this.innerTotalBudget().currency();
    }

    /**
     * Set the currency property: The type of currency being used for the value.
     *
     * @param currency the currency value to set.
     * @return the LabProperties object itself.
     */
    public LabProperties withCurrency(String currency) {
        if (this.innerTotalBudget() == null) {
            this.innerTotalBudget = new Amount();
        }
        this.innerTotalBudget().withCurrency(currency);
        return this;
    }

    /**
     * Get the value property: Amount value.
     *
     * @return the value value.
     */
    public Float value() {
        return this.innerTotalBudget() == null ? null : this.innerTotalBudget().value();
    }

    /**
     * Set the value property: Amount value.
     *
     * @param value the value value to set.
     * @return the LabProperties object itself.
     */
    public LabProperties withValue(Float value) {
        if (this.innerTotalBudget() == null) {
            this.innerTotalBudget = new Amount();
        }
        this.innerTotalBudget().withValue(value);
        return this;
    }

    /**
     * Get the currency property: The type of currency being used for the value.
     *
     * @return the currency value.
     */
    public String currencyTotalAllocatedBudgetCurrency() {
        return this.innerTotalAllocatedBudget() == null ? null : this.innerTotalAllocatedBudget().currency();
    }

    /**
     * Set the currency property: The type of currency being used for the value.
     *
     * @param currency the currency value to set.
     * @return the LabProperties object itself.
     */
    public LabProperties withCurrencyTotalAllocatedBudgetCurrency(String currency) {
        if (this.innerTotalAllocatedBudget() == null) {
            this.innerTotalAllocatedBudget = new Amount();
        }
        this.innerTotalAllocatedBudget().withCurrency(currency);
        return this;
    }

    /**
     * Get the value property: Amount value.
     *
     * @return the value value.
     */
    public Float valueTotalAllocatedBudgetValue() {
        return this.innerTotalAllocatedBudget() == null ? null : this.innerTotalAllocatedBudget().value();
    }

    /**
     * Set the value property: Amount value.
     *
     * @param value the value value to set.
     * @return the LabProperties object itself.
     */
    public LabProperties withValueTotalAllocatedBudgetValue(Float value) {
        if (this.innerTotalAllocatedBudget() == null) {
            this.innerTotalAllocatedBudget = new Amount();
        }
        this.innerTotalAllocatedBudget().withValue(value);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (displayName() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property displayName in model LabProperties"));
        }
        if (budgetPerStudent() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property budgetPerStudent in model LabProperties"));
        } else {
            budgetPerStudent().validate();
        }
        if (description() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property description in model LabProperties"));
        }
        if (expirationDate() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property expirationDate in model LabProperties"));
        }
        if (innerTotalBudget() != null) {
            innerTotalBudget().validate();
        }
        if (innerTotalAllocatedBudget() != null) {
            innerTotalAllocatedBudget().validate();
        }
    }

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