// Created with MonoDevelop
//
//    QuickStep: Acquire, view and identify spectra 
//    Copyright (C) 2022, Hiperscan GmbH Dresden, Germany
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.


using System;
using System.Globalization;
using Hiperscan.Unix;

namespace Hiperscan.ApoIdentCore.Misc
{
    public static class I18nDateFormat
    {
        public static DateTime EmptyDate => DateTime.MinValue;

        private static string output_date_format = String.Empty;
        public static string AdviceDateFormat
        {
            get
            {
                if (String.IsNullOrEmpty(I18nDateFormat.output_date_format))
                {
                    DateTime tmp = new DateTime(3333, 11, 22);
                    I18nDateFormat.output_date_format = tmp.ToString("d", CultureInfo.CurrentCulture);
                    I18nDateFormat.output_date_format = I18nDateFormat.output_date_format.Replace("3", Catalog.GetString("Y"));
                    I18nDateFormat.output_date_format = I18nDateFormat.output_date_format.Replace("2", Catalog.GetString("D"));
                    I18nDateFormat.output_date_format = I18nDateFormat.output_date_format.Replace("1", Catalog.GetString("M"));
                }

                return I18nDateFormat.output_date_format;
            }
        }

        private static string parse_date_format = String.Empty;
        public static string ParseDateFormat
        {

            get
            {
                if (String.IsNullOrEmpty(I18nDateFormat.parse_date_format))
                {
                    DateTime tmp = new DateTime(3333, 11, 22);
                    I18nDateFormat.parse_date_format = tmp.ToString("d", CultureInfo.CurrentCulture);
                    I18nDateFormat.parse_date_format = I18nDateFormat.parse_date_format.Replace("3", "y");
                    I18nDateFormat.parse_date_format = I18nDateFormat.parse_date_format.Replace("2", "d");
                    I18nDateFormat.parse_date_format = I18nDateFormat.parse_date_format.Replace("1", "M");
                }

                return I18nDateFormat.parse_date_format;
            }
        }
    }
}
