// 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.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Class to specify properties of content key. */
@Fluent
public final class StreamingPolicyContentKey {
    /*
     * Label can be used to specify Content Key when creating a Streaming Locator
     */
    @JsonProperty(value = "label")
    private String label;

    /*
     * Policy used by Content Key
     */
    @JsonProperty(value = "policyName")
    private String policyName;

    /*
     * Tracks which use this content key
     */
    @JsonProperty(value = "tracks")
    private List<TrackSelection> tracks;

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

    /**
     * Get the label property: Label can be used to specify Content Key when creating a Streaming Locator.
     *
     * @return the label value.
     */
    public String label() {
        return this.label;
    }

    /**
     * Set the label property: Label can be used to specify Content Key when creating a Streaming Locator.
     *
     * @param label the label value to set.
     * @return the StreamingPolicyContentKey object itself.
     */
    public StreamingPolicyContentKey withLabel(String label) {
        this.label = label;
        return this;
    }

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

    /**
     * Set the policyName property: Policy used by Content Key.
     *
     * @param policyName the policyName value to set.
     * @return the StreamingPolicyContentKey object itself.
     */
    public StreamingPolicyContentKey withPolicyName(String policyName) {
        this.policyName = policyName;
        return this;
    }

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

    /**
     * Set the tracks property: Tracks which use this content key.
     *
     * @param tracks the tracks value to set.
     * @return the StreamingPolicyContentKey object itself.
     */
    public StreamingPolicyContentKey withTracks(List<TrackSelection> tracks) {
        this.tracks = tracks;
        return this;
    }

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