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

package com.azure.resourcemanager.servicefabric.models;

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

/** Describes a partitioning scheme where an integer range is allocated evenly across a number of partitions. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "partitionScheme")
@JsonTypeName("UniformInt64Range")
@Fluent
public final class UniformInt64RangePartitionSchemeDescription extends PartitionSchemeDescription {
    /*
     * The number of partitions.
     */
    @JsonProperty(value = "count", required = true)
    private int count;

    /*
     * String indicating the lower bound of the partition key range that
     * should be split between the partition ‘count’
     *
     */
    @JsonProperty(value = "lowKey", required = true)
    private String lowKey;

    /*
     * String indicating the upper bound of the partition key range that
     * should be split between the partition ‘count’
     *
     */
    @JsonProperty(value = "highKey", required = true)
    private String highKey;

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

    /**
     * Get the count property: The number of partitions.
     *
     * @return the count value.
     */
    public int count() {
        return this.count;
    }

    /**
     * Set the count property: The number of partitions.
     *
     * @param count the count value to set.
     * @return the UniformInt64RangePartitionSchemeDescription object itself.
     */
    public UniformInt64RangePartitionSchemeDescription withCount(int count) {
        this.count = count;
        return this;
    }

    /**
     * Get the lowKey property: String indicating the lower bound of the partition key range that should be split
     * between the partition ‘count’.
     *
     * @return the lowKey value.
     */
    public String lowKey() {
        return this.lowKey;
    }

    /**
     * Set the lowKey property: String indicating the lower bound of the partition key range that should be split
     * between the partition ‘count’.
     *
     * @param lowKey the lowKey value to set.
     * @return the UniformInt64RangePartitionSchemeDescription object itself.
     */
    public UniformInt64RangePartitionSchemeDescription withLowKey(String lowKey) {
        this.lowKey = lowKey;
        return this;
    }

    /**
     * Get the highKey property: String indicating the upper bound of the partition key range that should be split
     * between the partition ‘count’.
     *
     * @return the highKey value.
     */
    public String highKey() {
        return this.highKey;
    }

    /**
     * Set the highKey property: String indicating the upper bound of the partition key range that should be split
     * between the partition ‘count’.
     *
     * @param highKey the highKey value to set.
     * @return the UniformInt64RangePartitionSchemeDescription object itself.
     */
    public UniformInt64RangePartitionSchemeDescription withHighKey(String highKey) {
        this.highKey = highKey;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (lowKey() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property lowKey in model UniformInt64RangePartitionSchemeDescription"));
        }
        if (highKey() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property highKey in model UniformInt64RangePartitionSchemeDescription"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(UniformInt64RangePartitionSchemeDescription.class);
}
