/**
 * 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.
 */

package com.microsoft.azure.management.logic.v2016_06_01.implementation;

import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl;
import com.microsoft.azure.management.logic.v2016_06_01.IntegrationAccount;
import rx.Observable;
import com.microsoft.azure.management.logic.v2016_06_01.IntegrationAccountSku;

class IntegrationAccountImpl extends GroupableResourceCoreImpl<IntegrationAccount, IntegrationAccountInner, IntegrationAccountImpl, LogicManager> implements IntegrationAccount, IntegrationAccount.Definition, IntegrationAccount.Update {
    IntegrationAccountImpl(String name, IntegrationAccountInner inner, LogicManager manager) {
        super(name, inner, manager);
    }

    @Override
    public Observable<IntegrationAccount> createResourceAsync() {
        IntegrationAccountsInner client = this.manager().inner().integrationAccounts();
        return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner())
            .map(innerToFluentMap(this));
    }

    @Override
    public Observable<IntegrationAccount> updateResourceAsync() {
        IntegrationAccountsInner client = this.manager().inner().integrationAccounts();
        return client.updateAsync(this.resourceGroupName(), this.name(), this.inner())
            .map(innerToFluentMap(this));
    }

    @Override
    protected Observable<IntegrationAccountInner> getInnerAsync() {
        IntegrationAccountsInner client = this.manager().inner().integrationAccounts();
        return client.getByResourceGroupAsync(this.resourceGroupName(), this.name());
    }

    @Override
    public boolean isInCreateMode() {
        return this.inner().id() == null;
    }


    @Override
    public Object properties() {
        return this.inner().properties();
    }

    @Override
    public IntegrationAccountSku sku() {
        return this.inner().sku();
    }

    @Override
    public IntegrationAccountImpl withProperties(Object properties) {
        this.inner().withProperties(properties);
        return this;
    }

    @Override
    public IntegrationAccountImpl withSku(IntegrationAccountSku sku) {
        this.inner().withSku(sku);
        return this;
    }

}
