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

package com.azure.resourcemanager.automation.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.automation.models.FieldDefinition;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** Definition of the connection type. */
@Fluent
public final class ConnectionTypeInner {
    /*
     * Gets the id of the resource.
     */
    @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
    private String id;

    /*
     * Gets the name of the connection type.
     */
    @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
    private String name;

    /*
     * Resource type
     */
    @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
    private String type;

    /*
     * Gets or sets the properties of the connection type.
     */
    @JsonProperty(value = "properties")
    private ConnectionTypeProperties innerProperties;

    /**
     * Get the id property: Gets the id of the resource.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Get the name property: Gets the name of the connection type.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Get the type property: Resource type.
     *
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Get the innerProperties property: Gets or sets the properties of the connection type.
     *
     * @return the innerProperties value.
     */
    private ConnectionTypeProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the isGlobal property: Gets or sets a Boolean value to indicate if the connection type is global.
     *
     * @return the isGlobal value.
     */
    public Boolean isGlobal() {
        return this.innerProperties() == null ? null : this.innerProperties().isGlobal();
    }

    /**
     * Set the isGlobal property: Gets or sets a Boolean value to indicate if the connection type is global.
     *
     * @param isGlobal the isGlobal value to set.
     * @return the ConnectionTypeInner object itself.
     */
    public ConnectionTypeInner withIsGlobal(Boolean isGlobal) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ConnectionTypeProperties();
        }
        this.innerProperties().withIsGlobal(isGlobal);
        return this;
    }

    /**
     * Get the fieldDefinitions property: Gets the field definitions of the connection type.
     *
     * @return the fieldDefinitions value.
     */
    public Map<String, FieldDefinition> fieldDefinitions() {
        return this.innerProperties() == null ? null : this.innerProperties().fieldDefinitions();
    }

    /**
     * Get the creationTime property: Gets the creation time.
     *
     * @return the creationTime value.
     */
    public OffsetDateTime creationTime() {
        return this.innerProperties() == null ? null : this.innerProperties().creationTime();
    }

    /**
     * Get the lastModifiedTime property: Gets or sets the last modified time.
     *
     * @return the lastModifiedTime value.
     */
    public OffsetDateTime lastModifiedTime() {
        return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTime();
    }

    /**
     * Set the lastModifiedTime property: Gets or sets the last modified time.
     *
     * @param lastModifiedTime the lastModifiedTime value to set.
     * @return the ConnectionTypeInner object itself.
     */
    public ConnectionTypeInner withLastModifiedTime(OffsetDateTime lastModifiedTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ConnectionTypeProperties();
        }
        this.innerProperties().withLastModifiedTime(lastModifiedTime);
        return this;
    }

    /**
     * Get the description property: Gets or sets the description.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: Gets or sets the description.
     *
     * @param description the description value to set.
     * @return the ConnectionTypeInner object itself.
     */
    public ConnectionTypeInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ConnectionTypeProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }
}
