using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AidA.Service
{
    public class DateUtils
    {
        public static DateTime? MaxTimestamp(DateTime? ts1, DateTime? ts2)
        {
            DateTime? maxTs = null;
            if (ts1 != null)
            {
                if (ts2 != null)
                {
                    if (ts2 > ts1)
                    {
                        maxTs = ts2;
                    }
                    else
                    {
                        maxTs = ts1;
                    }
                }
            }
            else if (ts2 != null)
            {
                maxTs = ts2;
            }
            return maxTs;
        }

        public static DateTime? MaxTimestamp(DateTime? ts1, DateTime? ts2, DateTime? ts3)
        {
            DateTime? maxTs = MaxTimestamp(ts1, ts2);

            if (ts3 != null && ts3 > maxTs)
            {
                maxTs = ts3;
            }

            return maxTs;
        }
    }
}
