// 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.models;

import com.azure.core.annotation.Immutable;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** The rebill details of an invoice. */
@Immutable
public final class RebillDetails {
    /*
     * The ID of credit note.
     */
    @JsonProperty(value = "creditNoteDocumentId", access = JsonProperty.Access.WRITE_ONLY)
    private String creditNoteDocumentId;

    /*
     * The ID of invoice.
     */
    @JsonProperty(value = "invoiceDocumentId", access = JsonProperty.Access.WRITE_ONLY)
    private String invoiceDocumentId;

    /*
     * Rebill details for an invoice.
     */
    @JsonProperty(value = "rebillDetails", access = JsonProperty.Access.WRITE_ONLY)
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, RebillDetails> rebillDetails;

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

    /**
     * Get the creditNoteDocumentId property: The ID of credit note.
     *
     * @return the creditNoteDocumentId value.
     */
    public String creditNoteDocumentId() {
        return this.creditNoteDocumentId;
    }

    /**
     * Get the invoiceDocumentId property: The ID of invoice.
     *
     * @return the invoiceDocumentId value.
     */
    public String invoiceDocumentId() {
        return this.invoiceDocumentId;
    }

    /**
     * Get the rebillDetails property: Rebill details for an invoice.
     *
     * @return the rebillDetails value.
     */
    public Map<String, RebillDetails> rebillDetails() {
        return this.rebillDetails;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (rebillDetails() != null) {
            rebillDetails()
                .values()
                .forEach(
                    e -> {
                        if (e != null) {
                            e.validate();
                        }
                    });
        }
    }
}
