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

package com.azure.resourcemanager.batchai.implementation;

import com.azure.core.util.Context;
import com.azure.resourcemanager.batchai.fluent.models.FileServerInner;
import com.azure.resourcemanager.batchai.models.DataDisks;
import com.azure.resourcemanager.batchai.models.FileServer;
import com.azure.resourcemanager.batchai.models.FileServerCreateParameters;
import com.azure.resourcemanager.batchai.models.FileServerProvisioningState;
import com.azure.resourcemanager.batchai.models.MountSettings;
import com.azure.resourcemanager.batchai.models.ResourceId;
import com.azure.resourcemanager.batchai.models.SshConfiguration;
import java.time.OffsetDateTime;

public final class FileServerImpl implements FileServer, FileServer.Definition {
    private FileServerInner innerObject;

    private final com.azure.resourcemanager.batchai.BatchAIManager serviceManager;

    FileServerImpl(FileServerInner innerObject, com.azure.resourcemanager.batchai.BatchAIManager 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 vmSize() {
        return this.innerModel().vmSize();
    }

    public SshConfiguration sshConfiguration() {
        return this.innerModel().sshConfiguration();
    }

    public DataDisks dataDisks() {
        return this.innerModel().dataDisks();
    }

    public ResourceId subnet() {
        return this.innerModel().subnet();
    }

    public MountSettings mountSettings() {
        return this.innerModel().mountSettings();
    }

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

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

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

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

    private com.azure.resourcemanager.batchai.BatchAIManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String workspaceName;

    private String fileServerName;

    private FileServerCreateParameters createParameters;

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

    public FileServer create() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getFileServers()
                .create(resourceGroupName, workspaceName, fileServerName, createParameters, Context.NONE);
        return this;
    }

    public FileServer create(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getFileServers()
                .create(resourceGroupName, workspaceName, fileServerName, createParameters, context);
        return this;
    }

    FileServerImpl(String name, com.azure.resourcemanager.batchai.BatchAIManager serviceManager) {
        this.innerObject = new FileServerInner();
        this.serviceManager = serviceManager;
        this.fileServerName = name;
        this.createParameters = new FileServerCreateParameters();
    }

    public FileServer refresh() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getFileServers()
                .getWithResponse(resourceGroupName, workspaceName, fileServerName, Context.NONE)
                .getValue();
        return this;
    }

    public FileServer refresh(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getFileServers()
                .getWithResponse(resourceGroupName, workspaceName, fileServerName, context)
                .getValue();
        return this;
    }

    public FileServerImpl withVmSize(String vmSize) {
        this.createParameters.withVmSize(vmSize);
        return this;
    }

    public FileServerImpl withSshConfiguration(SshConfiguration sshConfiguration) {
        this.createParameters.withSshConfiguration(sshConfiguration);
        return this;
    }

    public FileServerImpl withDataDisks(DataDisks dataDisks) {
        this.createParameters.withDataDisks(dataDisks);
        return this;
    }

    public FileServerImpl withSubnet(ResourceId subnet) {
        this.createParameters.withSubnet(subnet);
        return this;
    }
}
