using Sagitec.Rules.Core.Instance.Attributes;
using Sagitec.Rules.Core.Interface;
namespace Sagitec.Rules.Interface.Helper.Execution
{
/// <summary>
/// Provides various helper methods for working with date and time values.
/// This interface is marked as a Singleton, which means meaning there should only be one instance of its implementation.
/// </summary>
[SingletonInstance]
public interface IExecutionDateTimeHelper : ICoreInstance, IExecutionContextHelper
{
#region DateTime Arithmetic Methods
/// <summary>
/// Adds the specified number of days to the provided date.
/// </summary>
/// <param name="adtValue">The base date to which days are added.</param>
/// <param name="aintDays">The number of days to add.</param>
/// <returns>The updated DateTime value.</returns>
DateTime AddDays(DateTime adtValue, int aintDays);
/// <summary>
/// Adds the specified number of months to the provided date.
/// </summary>
/// <param name="adtValue">The base date to which months are added.</param>
/// <param name="aintMonths">The number of months to add.</param>
/// <returns>The updated DateTime value.</returns>
DateTime AddMonths(DateTime adtValue, int aintMonths);
/// <summary>
/// Adds the specified number of years to the provided date.
/// </summary>
/// <param name="adtValue">The base date to which years are added.</param>
/// <param name="aintYears">The number of years to add.</param>
/// <returns>The updated DateTime value.</returns>
DateTime AddYears(DateTime adtValue, int aintYears);
/// <summary>
/// Subtracts the specified number of days from the provided date.
/// </summary>
/// <param name="adtValue">The base date from which days are subtracted.</param>
/// <param name="aintDays">The number of days to subtract.</param>
/// <returns>The updated DateTime value.</returns>
DateTime SubtractDays(DateTime adtValue, int aintDays);
#endregion DateTime Arithmetic Methods
#region DateTime Component Retrieval Methods
/// <summary>
/// Gets the date component from the provided DateTime value.
/// </summary>
/// <param name="adtValue">The DateTime value from which the date is extracted.</param>
/// <returns>The date component of the provided DateTime value.</returns>
DateTime Date(DateTime adtValue);
/// <summary>
/// Gets the day of the month from the provided DateTime value.
/// </summary>
/// <param name="adtValue">The DateTime value from which the day of the month is extracted.</param>
/// <returns>The day of the month.</returns>
int GetDay(DateTime adtValue);
/// <summary>
/// Gets the day of the week from the provided DateTime value.
/// </summary>
/// <param name="adtValue">The DateTime value from which the day of the week is extracted.</param>
/// <returns>The day of the week.</returns>
DayOfWeek GetDayOfWeek(DateTime adtValue);
/// <summary>
/// Gets the day of the year from the provided DateTime value.
/// </summary>
/// <param name="adtValue">The DateTime value from which the day of the year is extracted.</param>
/// <returns>The day of the year.</returns>
int GetDayOfYear(DateTime adtValue);
/// <summary>
/// Gets the month component from the provided DateTime value.
/// </summary>
/// <param name="adtValue">The DateTime value from which the month is extracted.</param>
/// <returns>The month component.</returns>
int GetMonth(DateTime adtValue);
/// <summary>
/// Gets the year component from the provided DateTime value.
/// </summary>
/// <param name="adtValue">The DateTime value from which the year is extracted.</param>
/// <returns>The year component.</returns>
int GetYear(DateTime adtValue);
#endregion DateTime Component Retrieval Methods
#region DateTime Creation Methods
/// <summary>
/// Creates a new DateTime value based on the provided year, month, and day.
/// </summary>
/// <param name="aintYear">The year component.</param>
/// <param name="aintMonth">The month component.</param>
/// <param name="aintDay">The day component.</param>
/// <returns>A new DateTime value representing the specified date.</returns>
DateTime GetDateTime(int aintYear, int aintMonth, int aintDay);
/// <summary>
/// Creates a new DateTime value based on the provided year, month, day, hours, minutes, and seconds.
/// </summary>
/// <param name="aintYear">The year component.</param>
/// <param name="aintMonth">The month component.</param>
/// <param name="aintDay">The day component.</param>
/// <param name="aintHours">The hours component.</param>
/// <param name="aintMinutes">The minutes component.</param>
/// <param name="aintSeconds">The seconds component.</param>
/// <returns>A new DateTime value representing the specified date and time.</returns>
DateTime GetDateTime(int aintYear, int aintMonth, int aintDay, int aintHours, int aintMinutes, int aintSeconds);
#endregion DateTime Creation Methods
#region DateTime Difference Methods
/// <summary>
/// Gets the difference in days between two DateTime values.
/// </summary>
/// <param name="adtValue1">The first DateTime value.</param>
/// <param name="adtValue2">The second DateTime value.</param>
/// <returns>The difference in days.</returns>
int GetDaysDifference(DateTime adtValue1, DateTime adtValue2);
/// <summary>
/// Gets the difference in months between two DateTime values.
/// </summary>
/// <param name="adtValue1">The first DateTime value.</param>
/// <param name="adtValue2">The second DateTime value.</param>
/// <returns>The difference in months.</returns>
int GetMonthDifference(DateTime adtValue1, DateTime adtValue2);
#endregion DateTime Difference Methods
#region Date Validation and Conversion Methods
/// <summary>
/// Determines whether the provided string represents a valid date in the default format.
/// </summary>
/// <param name="astrDate">The string to check.</param>
/// <returns>True if the string represents a valid date; otherwise, false.</returns>
bool IsDate(string astrDate);
/// <summary>
/// Determines whether the provided string represents a valid date in the specified format.
/// </summary>
/// <param name="astrDate">The string to check.</param>
/// <param name="astrDateFormat">The date format to use for validation.</param>
/// <returns>True if the string represents a valid date; otherwise, false.</returns>
bool IsDate(string astrDate, string astrDateFormat);
/// <summary>
/// Converts the provided string to a DateTime value using the default date format.
/// </summary>
/// <param name="astrDate">The date string to convert.</param>
/// <returns>The corresponding DateTime value.</returns>
DateTime ToDate(string astrDate);
/// <summary>
/// Converts the provided string to a DateTime value using the default date and time format.
/// </summary>
/// <param name="astrDateTime">The date and time string to convert.</param>
/// <returns>The corresponding DateTime value.</returns>
DateTime ToDateTime(string astrDateTime);
#endregion Date Validation and Conversion Methods
#region Leap Year and Boundary Date Methods
/// <summary>
/// Determines whether the specified year is a leap year.
/// </summary>
/// <param name="aintYear">The year to check.</param>
/// <returns>True if the year is a leap year; otherwise, false.</returns>
bool IsLeapYear(int aintYear);
/// <summary>
/// Gets the maximum allowable DateTime value.
/// </summary>
/// <returns>The maximum DateTime value.</returns>
DateTime MaxDateTime();
/// <summary>
/// Gets the minimum allowable DateTime value.
/// </summary>
/// <returns>The minimum DateTime value.</returns>
DateTime MinDateTime();
#endregion Leap Year and Boundary Date Methods
}
}
}
#Rules