/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * abc
 */

package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation;

import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import com.microsoft.azure.management.maintenance.v2018_06_01_preview.ApplyUpdates;
import rx.functions.Func1;
import rx.Observable;
import com.microsoft.azure.management.maintenance.v2018_06_01_preview.ApplyUpdate;

class ApplyUpdatesImpl extends WrapperImpl<ApplyUpdatesInner> implements ApplyUpdates {
    private final MaintenanceManager manager;

    ApplyUpdatesImpl(MaintenanceManager manager) {
        super(manager.inner().applyUpdates());
        this.manager = manager;
    }

    public MaintenanceManager manager() {
        return this.manager;
    }

    @Override
    public Observable<ApplyUpdate> getParentAsync(String resourceGroupName, String resourceParentType, String resourceParentName, String providerName, String resourceType, String resourceName, String applyUpdateName) {
        ApplyUpdatesInner client = this.inner();
        return client.getParentAsync(resourceGroupName, resourceParentType, resourceParentName, providerName, resourceType, resourceName, applyUpdateName)
        .map(new Func1<ApplyUpdateInner, ApplyUpdate>() {
            @Override
            public ApplyUpdate call(ApplyUpdateInner inner) {
                return new ApplyUpdateImpl(inner, manager());
            }
        });
    }

    @Override
    public Observable<ApplyUpdate> getAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String applyUpdateName) {
        ApplyUpdatesInner client = this.inner();
        return client.getAsync(resourceGroupName, providerName, resourceType, resourceName, applyUpdateName)
        .map(new Func1<ApplyUpdateInner, ApplyUpdate>() {
            @Override
            public ApplyUpdate call(ApplyUpdateInner inner) {
                return new ApplyUpdateImpl(inner, manager());
            }
        });
    }

    @Override
    public Observable<ApplyUpdate> createOrUpdateParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName) {
        ApplyUpdatesInner client = this.inner();
        return client.createOrUpdateParentAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName)
        .map(new Func1<ApplyUpdateInner, ApplyUpdate>() {
            @Override
            public ApplyUpdate call(ApplyUpdateInner inner) {
                return new ApplyUpdateImpl(inner, manager());
            }
        });
    }

    @Override
    public Observable<ApplyUpdate> createOrUpdateAsync(String resourceGroupName, String providerName, String resourceType, String resourceName) {
        ApplyUpdatesInner client = this.inner();
        return client.createOrUpdateAsync(resourceGroupName, providerName, resourceType, resourceName)
        .map(new Func1<ApplyUpdateInner, ApplyUpdate>() {
            @Override
            public ApplyUpdate call(ApplyUpdateInner inner) {
                return new ApplyUpdateImpl(inner, manager());
            }
        });
    }

}
