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

package com.azure.resourcemanager.hybridnetwork.implementation;

import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.hybridnetwork.fluent.models.VendorSkuInner;
import com.azure.resourcemanager.hybridnetwork.models.NetworkFunctionTemplate;
import com.azure.resourcemanager.hybridnetwork.models.NetworkFunctionType;
import com.azure.resourcemanager.hybridnetwork.models.ProvisioningState;
import com.azure.resourcemanager.hybridnetwork.models.SkuDeploymentMode;
import com.azure.resourcemanager.hybridnetwork.models.SkuType;
import com.azure.resourcemanager.hybridnetwork.models.VendorSku;

public final class VendorSkuImpl implements VendorSku, VendorSku.Definition, VendorSku.Update {
    private VendorSkuInner innerObject;

    private final com.azure.resourcemanager.hybridnetwork.HybridNetworkManager serviceManager;

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

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

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

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

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

    public SkuType skuType() {
        return this.innerModel().skuType();
    }

    public SkuDeploymentMode deploymentMode() {
        return this.innerModel().deploymentMode();
    }

    public NetworkFunctionType networkFunctionType() {
        return this.innerModel().networkFunctionType();
    }

    public Boolean preview() {
        return this.innerModel().preview();
    }

    public Object managedApplicationParameters() {
        return this.innerModel().managedApplicationParameters();
    }

    public Object managedApplicationTemplate() {
        return this.innerModel().managedApplicationTemplate();
    }

    public NetworkFunctionTemplate networkFunctionTemplate() {
        return this.innerModel().networkFunctionTemplate();
    }

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

    private com.azure.resourcemanager.hybridnetwork.HybridNetworkManager manager() {
        return this.serviceManager;
    }

    private String vendorName;

    private String skuName;

    public VendorSkuImpl withExistingVendor(String vendorName) {
        this.vendorName = vendorName;
        return this;
    }

    public VendorSku create() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getVendorSkus()
                .createOrUpdate(vendorName, skuName, this.innerModel(), Context.NONE);
        return this;
    }

    public VendorSku create(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getVendorSkus()
                .createOrUpdate(vendorName, skuName, this.innerModel(), context);
        return this;
    }

    VendorSkuImpl(String name, com.azure.resourcemanager.hybridnetwork.HybridNetworkManager serviceManager) {
        this.innerObject = new VendorSkuInner();
        this.serviceManager = serviceManager;
        this.skuName = name;
    }

    public VendorSkuImpl update() {
        return this;
    }

    public VendorSku apply() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getVendorSkus()
                .createOrUpdate(vendorName, skuName, this.innerModel(), Context.NONE);
        return this;
    }

    public VendorSku apply(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getVendorSkus()
                .createOrUpdate(vendorName, skuName, this.innerModel(), context);
        return this;
    }

    VendorSkuImpl(
        VendorSkuInner innerObject, com.azure.resourcemanager.hybridnetwork.HybridNetworkManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.vendorName = Utils.getValueFromIdByName(innerObject.id(), "vendors");
        this.skuName = Utils.getValueFromIdByName(innerObject.id(), "vendorSkus");
    }

    public VendorSku refresh() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getVendorSkus()
                .getWithResponse(vendorName, skuName, Context.NONE)
                .getValue();
        return this;
    }

    public VendorSku refresh(Context context) {
        this.innerObject =
            serviceManager.serviceClient().getVendorSkus().getWithResponse(vendorName, skuName, context).getValue();
        return this;
    }

    public VendorSkuImpl withSkuType(SkuType skuType) {
        this.innerModel().withSkuType(skuType);
        return this;
    }

    public VendorSkuImpl withDeploymentMode(SkuDeploymentMode deploymentMode) {
        this.innerModel().withDeploymentMode(deploymentMode);
        return this;
    }

    public VendorSkuImpl withNetworkFunctionType(NetworkFunctionType networkFunctionType) {
        this.innerModel().withNetworkFunctionType(networkFunctionType);
        return this;
    }

    public VendorSkuImpl withPreview(Boolean preview) {
        this.innerModel().withPreview(preview);
        return this;
    }

    public VendorSkuImpl withManagedApplicationParameters(Object managedApplicationParameters) {
        this.innerModel().withManagedApplicationParameters(managedApplicationParameters);
        return this;
    }

    public VendorSkuImpl withManagedApplicationTemplate(Object managedApplicationTemplate) {
        this.innerModel().withManagedApplicationTemplate(managedApplicationTemplate);
        return this;
    }

    public VendorSkuImpl withNetworkFunctionTemplate(NetworkFunctionTemplate networkFunctionTemplate) {
        this.innerModel().withNetworkFunctionTemplate(networkFunctionTemplate);
        return this;
    }
}
