﻿using System;
using SimpleJSON;
using System.Runtime.InteropServices;

namespace ChatSDK {

    /**
     * The class that defines basic information of public groups.
     * 
     * To get basic information of a group from the server, you can call {@link IGroupManager#FetchPublicGroupsFromServer(int, String, ValueCallBack)}.
     */
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
    public class GroupInfo
    {
        /**
	     * The group ID.
	     */
        public string GroupId { get; internal set; }

        /**
	     * The group name.
	     */
        public string GroupName { get; internal set; }

        internal GroupInfo(string jsonString) {
            if (jsonString != null) {
                JSONNode jn = JSON.Parse(jsonString);
                if (!jn.IsNull)
                {
                    GroupId = jn["groupId"].Value;
                    GroupName = jn["groupName"].Value;
                }
            }
        }

        internal GroupInfo()
        {

        }

    }

}

