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

package azure.resourcemanager.commonproperties.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * ArmResourceIdentifier Resource Properties.
 */
@Fluent
public final class ArmResourceIdentifierResourceProperties
    implements JsonSerializable<ArmResourceIdentifierResourceProperties> {
    /*
     * The status of the last operation.
     */
    private ResourceProvisioningState provisioningState;

    /*
     * A basic ARM resource identifier without type or scopes.
     */
    private String simpleArmId;

    /*
     * An ARM resource identifier with type only.
     */
    private String armIdWithType;

    /*
     * An ARM resource identifier with type and scopes.
     */
    private String armIdWithTypeAndScope;

    /*
     * An ARM resource identifier with all scopes.
     */
    private String armIdWithAllScopes;

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

    /**
     * Get the provisioningState property: The status of the last operation.
     * 
     * @return the provisioningState value.
     */
    public ResourceProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the simpleArmId property: A basic ARM resource identifier without type or scopes.
     * 
     * @return the simpleArmId value.
     */
    public String simpleArmId() {
        return this.simpleArmId;
    }

    /**
     * Set the simpleArmId property: A basic ARM resource identifier without type or scopes.
     * 
     * @param simpleArmId the simpleArmId value to set.
     * @return the ArmResourceIdentifierResourceProperties object itself.
     */
    public ArmResourceIdentifierResourceProperties withSimpleArmId(String simpleArmId) {
        this.simpleArmId = simpleArmId;
        return this;
    }

    /**
     * Get the armIdWithType property: An ARM resource identifier with type only.
     * 
     * @return the armIdWithType value.
     */
    public String armIdWithType() {
        return this.armIdWithType;
    }

    /**
     * Set the armIdWithType property: An ARM resource identifier with type only.
     * 
     * @param armIdWithType the armIdWithType value to set.
     * @return the ArmResourceIdentifierResourceProperties object itself.
     */
    public ArmResourceIdentifierResourceProperties withArmIdWithType(String armIdWithType) {
        this.armIdWithType = armIdWithType;
        return this;
    }

    /**
     * Get the armIdWithTypeAndScope property: An ARM resource identifier with type and scopes.
     * 
     * @return the armIdWithTypeAndScope value.
     */
    public String armIdWithTypeAndScope() {
        return this.armIdWithTypeAndScope;
    }

    /**
     * Set the armIdWithTypeAndScope property: An ARM resource identifier with type and scopes.
     * 
     * @param armIdWithTypeAndScope the armIdWithTypeAndScope value to set.
     * @return the ArmResourceIdentifierResourceProperties object itself.
     */
    public ArmResourceIdentifierResourceProperties withArmIdWithTypeAndScope(String armIdWithTypeAndScope) {
        this.armIdWithTypeAndScope = armIdWithTypeAndScope;
        return this;
    }

    /**
     * Get the armIdWithAllScopes property: An ARM resource identifier with all scopes.
     * 
     * @return the armIdWithAllScopes value.
     */
    public String armIdWithAllScopes() {
        return this.armIdWithAllScopes;
    }

    /**
     * Set the armIdWithAllScopes property: An ARM resource identifier with all scopes.
     * 
     * @param armIdWithAllScopes the armIdWithAllScopes value to set.
     * @return the ArmResourceIdentifierResourceProperties object itself.
     */
    public ArmResourceIdentifierResourceProperties withArmIdWithAllScopes(String armIdWithAllScopes) {
        this.armIdWithAllScopes = armIdWithAllScopes;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("simpleArmId", this.simpleArmId);
        jsonWriter.writeStringField("armIdWithType", this.armIdWithType);
        jsonWriter.writeStringField("armIdWithTypeAndScope", this.armIdWithTypeAndScope);
        jsonWriter.writeStringField("armIdWithAllScopes", this.armIdWithAllScopes);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of ArmResourceIdentifierResourceProperties from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of ArmResourceIdentifierResourceProperties if the JsonReader was pointing to an instance of
     * it, or null if it was pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the ArmResourceIdentifierResourceProperties.
     */
    public static ArmResourceIdentifierResourceProperties fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            ArmResourceIdentifierResourceProperties deserializedArmResourceIdentifierResourceProperties
                = new ArmResourceIdentifierResourceProperties();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("provisioningState".equals(fieldName)) {
                    deserializedArmResourceIdentifierResourceProperties.provisioningState
                        = ResourceProvisioningState.fromString(reader.getString());
                } else if ("simpleArmId".equals(fieldName)) {
                    deserializedArmResourceIdentifierResourceProperties.simpleArmId = reader.getString();
                } else if ("armIdWithType".equals(fieldName)) {
                    deserializedArmResourceIdentifierResourceProperties.armIdWithType = reader.getString();
                } else if ("armIdWithTypeAndScope".equals(fieldName)) {
                    deserializedArmResourceIdentifierResourceProperties.armIdWithTypeAndScope = reader.getString();
                } else if ("armIdWithAllScopes".equals(fieldName)) {
                    deserializedArmResourceIdentifierResourceProperties.armIdWithAllScopes = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedArmResourceIdentifierResourceProperties;
        });
    }
}
