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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** An instruction. */
@Fluent
public final class InstructionInner extends ProxyResource {
    /*
     * A billing instruction used during invoice generation.
     */
    @JsonProperty(value = "properties")
    private InstructionProperties innerProperties;

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

    /**
     * Get the innerProperties property: A billing instruction used during invoice generation.
     *
     * @return the innerProperties value.
     */
    private InstructionProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the amount property: The amount budgeted for this billing instruction.
     *
     * @return the amount value.
     */
    public Float amount() {
        return this.innerProperties() == null ? null : this.innerProperties().amount();
    }

    /**
     * Set the amount property: The amount budgeted for this billing instruction.
     *
     * @param amount the amount value to set.
     * @return the InstructionInner object itself.
     */
    public InstructionInner withAmount(Float amount) {
        if (this.innerProperties() == null) {
            this.innerProperties = new InstructionProperties();
        }
        this.innerProperties().withAmount(amount);
        return this;
    }

    /**
     * Get the startDate property: The date this billing instruction goes into effect.
     *
     * @return the startDate value.
     */
    public OffsetDateTime startDate() {
        return this.innerProperties() == null ? null : this.innerProperties().startDate();
    }

    /**
     * Set the startDate property: The date this billing instruction goes into effect.
     *
     * @param startDate the startDate value to set.
     * @return the InstructionInner object itself.
     */
    public InstructionInner withStartDate(OffsetDateTime startDate) {
        if (this.innerProperties() == null) {
            this.innerProperties = new InstructionProperties();
        }
        this.innerProperties().withStartDate(startDate);
        return this;
    }

    /**
     * Get the endDate property: The date this billing instruction is no longer in effect.
     *
     * @return the endDate value.
     */
    public OffsetDateTime endDate() {
        return this.innerProperties() == null ? null : this.innerProperties().endDate();
    }

    /**
     * Set the endDate property: The date this billing instruction is no longer in effect.
     *
     * @param endDate the endDate value to set.
     * @return the InstructionInner object itself.
     */
    public InstructionInner withEndDate(OffsetDateTime endDate) {
        if (this.innerProperties() == null) {
            this.innerProperties = new InstructionProperties();
        }
        this.innerProperties().withEndDate(endDate);
        return this;
    }

    /**
     * Get the creationDate property: The date this billing instruction was created.
     *
     * @return the creationDate value.
     */
    public OffsetDateTime creationDate() {
        return this.innerProperties() == null ? null : this.innerProperties().creationDate();
    }

    /**
     * Set the creationDate property: The date this billing instruction was created.
     *
     * @param creationDate the creationDate value to set.
     * @return the InstructionInner object itself.
     */
    public InstructionInner withCreationDate(OffsetDateTime creationDate) {
        if (this.innerProperties() == null) {
            this.innerProperties = new InstructionProperties();
        }
        this.innerProperties().withCreationDate(creationDate);
        return this;
    }

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