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

package com.azure.resourcemanager.securityinsights.implementation;

import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.securityinsights.fluent.models.SentinelOnboardingStateInner;
import com.azure.resourcemanager.securityinsights.models.SentinelOnboardingState;

public final class SentinelOnboardingStateImpl implements SentinelOnboardingState, SentinelOnboardingState.Definition {
    private SentinelOnboardingStateInner innerObject;

    private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager;

    SentinelOnboardingStateImpl(
        SentinelOnboardingStateInner innerObject,
        com.azure.resourcemanager.securityinsights.SecurityInsightsManager 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 String etag() {
        return this.innerModel().etag();
    }

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

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

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

    private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String workspaceName;

    private String sentinelOnboardingStateName;

    public SentinelOnboardingStateImpl withExistingWorkspace(String resourceGroupName, String workspaceName) {
        this.resourceGroupName = resourceGroupName;
        this.workspaceName = workspaceName;
        return this;
    }

    public SentinelOnboardingState create() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getSentinelOnboardingStates()
                .createWithResponse(
                    resourceGroupName, workspaceName, sentinelOnboardingStateName, this.innerModel(), Context.NONE)
                .getValue();
        return this;
    }

    public SentinelOnboardingState create(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getSentinelOnboardingStates()
                .createWithResponse(
                    resourceGroupName, workspaceName, sentinelOnboardingStateName, this.innerModel(), context)
                .getValue();
        return this;
    }

    SentinelOnboardingStateImpl(
        String name, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) {
        this.innerObject = new SentinelOnboardingStateInner();
        this.serviceManager = serviceManager;
        this.sentinelOnboardingStateName = name;
    }

    public SentinelOnboardingState refresh() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getSentinelOnboardingStates()
                .getWithResponse(resourceGroupName, workspaceName, sentinelOnboardingStateName, Context.NONE)
                .getValue();
        return this;
    }

    public SentinelOnboardingState refresh(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getSentinelOnboardingStates()
                .getWithResponse(resourceGroupName, workspaceName, sentinelOnboardingStateName, context)
                .getValue();
        return this;
    }

    public SentinelOnboardingStateImpl withEtag(String etag) {
        this.innerModel().withEtag(etag);
        return this;
    }

    public SentinelOnboardingStateImpl withCustomerManagedKey(Boolean customerManagedKey) {
        this.innerModel().withCustomerManagedKey(customerManagedKey);
        return this;
    }
}
