using System;
using System.Collections.Generic;

namespace Com.Bocom.OpenApi
{
    namespace Utils
    {
        public class BocomHashMap : Dictionary<string, string>
        {
            private static long serialVersionUID = 8026336190683519216L;

            public BocomHashMap() : base()
            {
            }


            public string Put(string key, Object value)
            {
                string strValue;

                if (value == null)
                {
                    strValue = null;
                }
                else if (value is string)
                {
                    strValue = (string) value;
                }
                else if (value is int)
                {
                    strValue = Convert.ToString(value);
                }
                else if (value is long)
                {
                    strValue = Convert.ToString(value);
                }
                else if (value is float)
                {
                    strValue = Convert.ToString(value);
                }
                else if (value is Double)
                {
                    strValue = Convert.ToString(value);
                }
                else if (value is Boolean)
                {
                    strValue = Convert.ToString(value);
                }
                else if (value is DateTime)
                {
                    string format = BocomConstants.DATE_TIME_FORMAT;
                    //  format.setTimeZone(TimeZone.getTimeZone(BocomConstants.DATE_TIMEZONE));
                    strValue = Convert.ToString(value);
                }
                else
                {
                    strValue = Convert.ToString(value);
                }

                return Put(key, strValue);
            }

            public string Put(string key, string value)
            {
                if (key != string.Empty && value != string.Empty)
                {
                    return Put(key, value);
                }

                return null;
            }
        }
    }
}