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

package com.azure.resourcemanager.mediaservices.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.UUID;

/** Class for content key in Streaming Locator. */
@Fluent
public final class StreamingLocatorContentKey {
    /*
     * ID of Content Key
     */
    @JsonProperty(value = "id", required = true)
    private UUID id;

    /*
     * Encryption type of Content Key
     */
    @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
    private StreamingLocatorContentKeyType type;

    /*
     * Label of Content Key as specified in the Streaming Policy
     */
    @JsonProperty(value = "labelReferenceInStreamingPolicy")
    private String labelReferenceInStreamingPolicy;

    /*
     * Value of Content Key
     */
    @JsonProperty(value = "value")
    private String value;

    /*
     * ContentKeyPolicy used by Content Key
     */
    @JsonProperty(value = "policyName", access = JsonProperty.Access.WRITE_ONLY)
    private String policyName;

    /*
     * Tracks which use this Content Key
     */
    @JsonProperty(value = "tracks", access = JsonProperty.Access.WRITE_ONLY)
    private List<TrackSelection> tracks;

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

    /**
     * Get the id property: ID of Content Key.
     *
     * @return the id value.
     */
    public UUID id() {
        return this.id;
    }

    /**
     * Set the id property: ID of Content Key.
     *
     * @param id the id value to set.
     * @return the StreamingLocatorContentKey object itself.
     */
    public StreamingLocatorContentKey withId(UUID id) {
        this.id = id;
        return this;
    }

    /**
     * Get the type property: Encryption type of Content Key.
     *
     * @return the type value.
     */
    public StreamingLocatorContentKeyType type() {
        return this.type;
    }

    /**
     * Get the labelReferenceInStreamingPolicy property: Label of Content Key as specified in the Streaming Policy.
     *
     * @return the labelReferenceInStreamingPolicy value.
     */
    public String labelReferenceInStreamingPolicy() {
        return this.labelReferenceInStreamingPolicy;
    }

    /**
     * Set the labelReferenceInStreamingPolicy property: Label of Content Key as specified in the Streaming Policy.
     *
     * @param labelReferenceInStreamingPolicy the labelReferenceInStreamingPolicy value to set.
     * @return the StreamingLocatorContentKey object itself.
     */
    public StreamingLocatorContentKey withLabelReferenceInStreamingPolicy(String labelReferenceInStreamingPolicy) {
        this.labelReferenceInStreamingPolicy = labelReferenceInStreamingPolicy;
        return this;
    }

    /**
     * Get the value property: Value of Content Key.
     *
     * @return the value value.
     */
    public String value() {
        return this.value;
    }

    /**
     * Set the value property: Value of Content Key.
     *
     * @param value the value value to set.
     * @return the StreamingLocatorContentKey object itself.
     */
    public StreamingLocatorContentKey withValue(String value) {
        this.value = value;
        return this;
    }

    /**
     * Get the policyName property: ContentKeyPolicy used by Content Key.
     *
     * @return the policyName value.
     */
    public String policyName() {
        return this.policyName;
    }

    /**
     * Get the tracks property: Tracks which use this Content Key.
     *
     * @return the tracks value.
     */
    public List<TrackSelection> tracks() {
        return this.tracks;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (id() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property id in model StreamingLocatorContentKey"));
        }
        if (tracks() != null) {
            tracks().forEach(e -> e.validate());
        }
    }

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