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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.confluent.models.OfferDetail;
import com.azure.resourcemanager.confluent.models.ProvisionState;
import com.azure.resourcemanager.confluent.models.UserDetail;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** Organization resource. */
@Fluent
public final class OrganizationResourceInner extends Resource {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(OrganizationResourceInner.class);

    /*
     * Metadata pertaining to creation and last modification of the resource
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /*
     * Organization resource properties
     */
    @JsonProperty(value = "properties", required = true)
    private OrganizationResourceProperties innerProperties = new OrganizationResourceProperties();

    /**
     * Get the systemData property: Metadata pertaining to creation and last modification of the resource.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the innerProperties property: Organization resource properties.
     *
     * @return the innerProperties value.
     */
    private OrganizationResourceProperties innerProperties() {
        return this.innerProperties;
    }

    /** {@inheritDoc} */
    @Override
    public OrganizationResourceInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public OrganizationResourceInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

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

    /**
     * Get the provisioningState property: ProvisioningState Provision states for confluent RP.
     *
     * @return the provisioningState value.
     */
    public ProvisionState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the organizationId property: Id of the Confluent organization.
     *
     * @return the organizationId value.
     */
    public String organizationId() {
        return this.innerProperties() == null ? null : this.innerProperties().organizationId();
    }

    /**
     * Get the ssoUrl property: SSO url for the Confluent organization.
     *
     * @return the ssoUrl value.
     */
    public String ssoUrl() {
        return this.innerProperties() == null ? null : this.innerProperties().ssoUrl();
    }

    /**
     * Get the offerDetail property: Confluent offer detail.
     *
     * @return the offerDetail value.
     */
    public OfferDetail offerDetail() {
        return this.innerProperties() == null ? null : this.innerProperties().offerDetail();
    }

    /**
     * Set the offerDetail property: Confluent offer detail.
     *
     * @param offerDetail the offerDetail value to set.
     * @return the OrganizationResourceInner object itself.
     */
    public OrganizationResourceInner withOfferDetail(OfferDetail offerDetail) {
        if (this.innerProperties() == null) {
            this.innerProperties = new OrganizationResourceProperties();
        }
        this.innerProperties().withOfferDetail(offerDetail);
        return this;
    }

    /**
     * Get the userDetail property: Subscriber detail.
     *
     * @return the userDetail value.
     */
    public UserDetail userDetail() {
        return this.innerProperties() == null ? null : this.innerProperties().userDetail();
    }

    /**
     * Set the userDetail property: Subscriber detail.
     *
     * @param userDetail the userDetail value to set.
     * @return the OrganizationResourceInner object itself.
     */
    public OrganizationResourceInner withUserDetail(UserDetail userDetail) {
        if (this.innerProperties() == null) {
            this.innerProperties = new OrganizationResourceProperties();
        }
        this.innerProperties().withUserDetail(userDetail);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property innerProperties in model OrganizationResourceInner"));
        } else {
            innerProperties().validate();
        }
    }
}
