All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.billing.models.AgreementProperties Maven / Gradle / Ivy

// 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.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;

/**
 * An agreement.
 */
@Immutable
public final class AgreementProperties implements JsonSerializable {
    /*
     * The mode of acceptance for an agreement.
     */
    private AcceptanceMode acceptanceMode;

    /*
     * The URL to download the agreement.
     */
    private String agreementLink;

    /*
     * The list of billing profiles associated with agreement and present only for specific agreements.
     */
    private List billingProfileInfo;

    /*
     * The category of the agreement.
     */
    private Category category;

    /*
     * The name of the agreement signed by a customer.
     */
    private String displayName;

    /*
     * The date from which the agreement is effective.
     */
    private OffsetDateTime effectiveDate;

    /*
     * The date when the agreement expires.
     */
    private OffsetDateTime expirationDate;

    /*
     * The list of participants that participates in acceptance of an agreement.
     */
    private List participants;

    /*
     * The current status of the agreement.
     */
    private String status;

    /*
     * The ID of the lead billing account if this agreement is part of the Customer Affiliate Purchase Terms.
     */
    private String leadBillingAccountName;

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

    /**
     * Get the acceptanceMode property: The mode of acceptance for an agreement.
     * 
     * @return the acceptanceMode value.
     */
    public AcceptanceMode acceptanceMode() {
        return this.acceptanceMode;
    }

    /**
     * Get the agreementLink property: The URL to download the agreement.
     * 
     * @return the agreementLink value.
     */
    public String agreementLink() {
        return this.agreementLink;
    }

    /**
     * Get the billingProfileInfo property: The list of billing profiles associated with agreement and present only for
     * specific agreements.
     * 
     * @return the billingProfileInfo value.
     */
    public List billingProfileInfo() {
        return this.billingProfileInfo;
    }

    /**
     * Get the category property: The category of the agreement.
     * 
     * @return the category value.
     */
    public Category category() {
        return this.category;
    }

    /**
     * Get the displayName property: The name of the agreement signed by a customer.
     * 
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Get the effectiveDate property: The date from which the agreement is effective.
     * 
     * @return the effectiveDate value.
     */
    public OffsetDateTime effectiveDate() {
        return this.effectiveDate;
    }

    /**
     * Get the expirationDate property: The date when the agreement expires.
     * 
     * @return the expirationDate value.
     */
    public OffsetDateTime expirationDate() {
        return this.expirationDate;
    }

    /**
     * Get the participants property: The list of participants that participates in acceptance of an agreement.
     * 
     * @return the participants value.
     */
    public List participants() {
        return this.participants;
    }

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

    /**
     * Get the leadBillingAccountName property: The ID of the lead billing account if this agreement is part of the
     * Customer Affiliate Purchase Terms.
     * 
     * @return the leadBillingAccountName value.
     */
    public String leadBillingAccountName() {
        return this.leadBillingAccountName;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of AgreementProperties from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of AgreementProperties if the JsonReader was pointing to an instance of it, or null if it was
     * pointing to JSON null.
     * @throws IOException If an error occurs while reading the AgreementProperties.
     */
    public static AgreementProperties fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            AgreementProperties deserializedAgreementProperties = new AgreementProperties();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("acceptanceMode".equals(fieldName)) {
                    deserializedAgreementProperties.acceptanceMode = AcceptanceMode.fromString(reader.getString());
                } else if ("agreementLink".equals(fieldName)) {
                    deserializedAgreementProperties.agreementLink = reader.getString();
                } else if ("billingProfileInfo".equals(fieldName)) {
                    List billingProfileInfo
                        = reader.readArray(reader1 -> BillingProfileInfo.fromJson(reader1));
                    deserializedAgreementProperties.billingProfileInfo = billingProfileInfo;
                } else if ("category".equals(fieldName)) {
                    deserializedAgreementProperties.category = Category.fromString(reader.getString());
                } else if ("displayName".equals(fieldName)) {
                    deserializedAgreementProperties.displayName = reader.getString();
                } else if ("effectiveDate".equals(fieldName)) {
                    deserializedAgreementProperties.effectiveDate = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("expirationDate".equals(fieldName)) {
                    deserializedAgreementProperties.expirationDate = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("participants".equals(fieldName)) {
                    List participants = reader.readArray(reader1 -> Participant.fromJson(reader1));
                    deserializedAgreementProperties.participants = participants;
                } else if ("status".equals(fieldName)) {
                    deserializedAgreementProperties.status = reader.getString();
                } else if ("leadBillingAccountName".equals(fieldName)) {
                    deserializedAgreementProperties.leadBillingAccountName = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAgreementProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy