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

package com.azure.resourcemanager.reservations.implementation;

import com.azure.core.management.SystemData;
import com.azure.resourcemanager.reservations.fluent.models.ReservationOrderResponseInner;
import com.azure.resourcemanager.reservations.fluent.models.ReservationResponseInner;
import com.azure.resourcemanager.reservations.models.ProvisioningState;
import com.azure.resourcemanager.reservations.models.ReservationBillingPlan;
import com.azure.resourcemanager.reservations.models.ReservationOrderBillingPlanInformation;
import com.azure.resourcemanager.reservations.models.ReservationOrderResponse;
import com.azure.resourcemanager.reservations.models.ReservationResponse;
import com.azure.resourcemanager.reservations.models.ReservationTerm;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public final class ReservationOrderResponseImpl implements ReservationOrderResponse {
    private ReservationOrderResponseInner innerObject;

    private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager;

    ReservationOrderResponseImpl(
        ReservationOrderResponseInner innerObject,
        com.azure.resourcemanager.reservations.ReservationsManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
    }

    public String id() {
        return this.innerModel().id();
    }

    public String name() {
        return this.innerModel().name();
    }

    public String type() {
        return this.innerModel().type();
    }

    public Integer etag() {
        return this.innerModel().etag();
    }

    public SystemData systemData() {
        return this.innerModel().systemData();
    }

    public String displayName() {
        return this.innerModel().displayName();
    }

    public OffsetDateTime requestDateTime() {
        return this.innerModel().requestDateTime();
    }

    public OffsetDateTime createdDateTime() {
        return this.innerModel().createdDateTime();
    }

    public LocalDate expiryDate() {
        return this.innerModel().expiryDate();
    }

    public OffsetDateTime expiryDateTime() {
        return this.innerModel().expiryDateTime();
    }

    public OffsetDateTime benefitStartTime() {
        return this.innerModel().benefitStartTime();
    }

    public Integer originalQuantity() {
        return this.innerModel().originalQuantity();
    }

    public ReservationTerm term() {
        return this.innerModel().term();
    }

    public ProvisioningState provisioningState() {
        return this.innerModel().provisioningState();
    }

    public ReservationBillingPlan billingPlan() {
        return this.innerModel().billingPlan();
    }

    public ReservationOrderBillingPlanInformation planInformation() {
        return this.innerModel().planInformation();
    }

    public List<ReservationResponse> reservations() {
        List<ReservationResponseInner> inner = this.innerModel().reservations();
        if (inner != null) {
            return Collections
                .unmodifiableList(
                    inner
                        .stream()
                        .map(inner1 -> new ReservationResponseImpl(inner1, this.manager()))
                        .collect(Collectors.toList()));
        } else {
            return Collections.emptyList();
        }
    }

    public OffsetDateTime reviewDateTime() {
        return this.innerModel().reviewDateTime();
    }

    public ReservationOrderResponseInner innerModel() {
        return this.innerObject;
    }

    private com.azure.resourcemanager.reservations.ReservationsManager manager() {
        return this.serviceManager;
    }
}
