// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>

namespace Microsoft.Azure.Management.DataFactory.Models
{
    using Microsoft.Rest;
    using Newtonsoft.Json;
    using System.Linq;

    /// <summary>
    /// An object to provide order by options for listing runs.
    /// </summary>
    public partial class RunQueryOrderBy
    {
        /// <summary>
        /// Initializes a new instance of the RunQueryOrderBy class.
        /// </summary>
        public RunQueryOrderBy()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the RunQueryOrderBy class.
        /// </summary>
        /// <param name="orderBy">Parameter name to be used for order by. The
        /// allowed parameters to order by for pipeline runs are PipelineName,
        /// RunStart, RunEnd and Status; for activity runs are ActivityName,
        /// ActivityRunStart, ActivityRunEnd and Status; for trigger runs are
        /// TriggerName, TriggerRunTimestamp and Status. Possible values
        /// include: 'RunStart', 'RunEnd', 'PipelineName', 'Status',
        /// 'ActivityName', 'ActivityRunStart', 'ActivityRunEnd',
        /// 'TriggerName', 'TriggerRunTimestamp'</param>
        /// <param name="order">Sorting order of the parameter. Possible values
        /// include: 'ASC', 'DESC'</param>
        public RunQueryOrderBy(string orderBy, string order)
        {
            OrderBy = orderBy;
            Order = order;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets parameter name to be used for order by. The allowed
        /// parameters to order by for pipeline runs are PipelineName,
        /// RunStart, RunEnd and Status; for activity runs are ActivityName,
        /// ActivityRunStart, ActivityRunEnd and Status; for trigger runs are
        /// TriggerName, TriggerRunTimestamp and Status. Possible values
        /// include: 'RunStart', 'RunEnd', 'PipelineName', 'Status',
        /// 'ActivityName', 'ActivityRunStart', 'ActivityRunEnd',
        /// 'TriggerName', 'TriggerRunTimestamp'
        /// </summary>
        [JsonProperty(PropertyName = "orderBy")]
        public string OrderBy { get; set; }

        /// <summary>
        /// Gets or sets sorting order of the parameter. Possible values
        /// include: 'ASC', 'DESC'
        /// </summary>
        [JsonProperty(PropertyName = "order")]
        public string Order { get; set; }

        /// <summary>
        /// Validate the object.
        /// </summary>
        /// <exception cref="ValidationException">
        /// Thrown if validation fails
        /// </exception>
        public virtual void Validate()
        {
            if (OrderBy == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "OrderBy");
            }
            if (Order == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "Order");
            }
        }
    }
}
