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

package com.azure.resourcemanager.imagebuilder.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/** Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart provisioner. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonTypeName("WindowsRestart")
@Fluent
public final class ImageTemplateRestartCustomizer extends ImageTemplateCustomizer {
    /*
     * Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"']
     */
    @JsonProperty(value = "restartCommand")
    private String restartCommand;

    /*
     * Command to check if restart succeeded [Default: '']
     */
    @JsonProperty(value = "restartCheckCommand")
    private String restartCheckCommand;

    /*
     * Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default:
     * '5m']
     */
    @JsonProperty(value = "restartTimeout")
    private String restartTimeout;

    /** Creates an instance of ImageTemplateRestartCustomizer class. */
    public ImageTemplateRestartCustomizer() {
    }

    /**
     * Get the restartCommand property: Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer
     * restart"'].
     *
     * @return the restartCommand value.
     */
    public String restartCommand() {
        return this.restartCommand;
    }

    /**
     * Set the restartCommand property: Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer
     * restart"'].
     *
     * @param restartCommand the restartCommand value to set.
     * @return the ImageTemplateRestartCustomizer object itself.
     */
    public ImageTemplateRestartCustomizer withRestartCommand(String restartCommand) {
        this.restartCommand = restartCommand;
        return this;
    }

    /**
     * Get the restartCheckCommand property: Command to check if restart succeeded [Default: ''].
     *
     * @return the restartCheckCommand value.
     */
    public String restartCheckCommand() {
        return this.restartCheckCommand;
    }

    /**
     * Set the restartCheckCommand property: Command to check if restart succeeded [Default: ''].
     *
     * @param restartCheckCommand the restartCheckCommand value to set.
     * @return the ImageTemplateRestartCustomizer object itself.
     */
    public ImageTemplateRestartCustomizer withRestartCheckCommand(String restartCheckCommand) {
        this.restartCheckCommand = restartCheckCommand;
        return this;
    }

    /**
     * Get the restartTimeout property: Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5
     * minutes) or '2h' (2 hours) [Default: '5m'].
     *
     * @return the restartTimeout value.
     */
    public String restartTimeout() {
        return this.restartTimeout;
    }

    /**
     * Set the restartTimeout property: Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5
     * minutes) or '2h' (2 hours) [Default: '5m'].
     *
     * @param restartTimeout the restartTimeout value to set.
     * @return the ImageTemplateRestartCustomizer object itself.
     */
    public ImageTemplateRestartCustomizer withRestartTimeout(String restartTimeout) {
        this.restartTimeout = restartTimeout;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ImageTemplateRestartCustomizer withName(String name) {
        super.withName(name);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
    }
}
