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

package com.azure.analytics.synapse.artifacts.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.annotation.JsonFlatten;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.List;

/** This activity is used for iterating over a collection and execute given activities. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonTypeName("ForEach")
@JsonFlatten
@Fluent
public class ForEachActivity extends ControlActivity {
    /*
     * Should the loop be executed in sequence or in parallel (max 50)
     */
    @JsonProperty(value = "typeProperties.isSequential")
    private Boolean isSequential;

    /*
     * Batch count to be used for controlling the number of parallel execution (when isSequential is set to false).
     */
    @JsonProperty(value = "typeProperties.batchCount")
    private Integer batchCount;

    /*
     * Collection to iterate.
     */
    @JsonProperty(value = "typeProperties.items", required = true)
    private Expression items;

    /*
     * List of activities to execute .
     */
    @JsonProperty(value = "typeProperties.activities", required = true)
    private List<Activity> activities;

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

    /**
     * Get the isSequential property: Should the loop be executed in sequence or in parallel (max 50).
     *
     * @return the isSequential value.
     */
    public Boolean isSequential() {
        return this.isSequential;
    }

    /**
     * Set the isSequential property: Should the loop be executed in sequence or in parallel (max 50).
     *
     * @param isSequential the isSequential value to set.
     * @return the ForEachActivity object itself.
     */
    public ForEachActivity setIsSequential(Boolean isSequential) {
        this.isSequential = isSequential;
        return this;
    }

    /**
     * Get the batchCount property: Batch count to be used for controlling the number of parallel execution (when
     * isSequential is set to false).
     *
     * @return the batchCount value.
     */
    public Integer getBatchCount() {
        return this.batchCount;
    }

    /**
     * Set the batchCount property: Batch count to be used for controlling the number of parallel execution (when
     * isSequential is set to false).
     *
     * @param batchCount the batchCount value to set.
     * @return the ForEachActivity object itself.
     */
    public ForEachActivity setBatchCount(Integer batchCount) {
        this.batchCount = batchCount;
        return this;
    }

    /**
     * Get the items property: Collection to iterate.
     *
     * @return the items value.
     */
    public Expression getItems() {
        return this.items;
    }

    /**
     * Set the items property: Collection to iterate.
     *
     * @param items the items value to set.
     * @return the ForEachActivity object itself.
     */
    public ForEachActivity setItems(Expression items) {
        this.items = items;
        return this;
    }

    /**
     * Get the activities property: List of activities to execute .
     *
     * @return the activities value.
     */
    public List<Activity> getActivities() {
        return this.activities;
    }

    /**
     * Set the activities property: List of activities to execute .
     *
     * @param activities the activities value to set.
     * @return the ForEachActivity object itself.
     */
    public ForEachActivity setActivities(List<Activity> activities) {
        this.activities = activities;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ForEachActivity setName(String name) {
        super.setName(name);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ForEachActivity setDescription(String description) {
        super.setDescription(description);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ForEachActivity setDependsOn(List<ActivityDependency> dependsOn) {
        super.setDependsOn(dependsOn);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ForEachActivity setUserProperties(List<UserProperty> userProperties) {
        super.setUserProperties(userProperties);
        return this;
    }
}
