using ASPSnippets.GoogleAPI;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;

namespace EnvigoHiring.Models.Login
{
    public class GLogin
    {
        public string clientid = "261213523242-fjma3ocn8aes9dda9grlu15jpmkti799.apps.googleusercontent.com";
        public string clientsecret = "c2btFMstqHWoVi2qi7QgdrpQ";
        public string redirection_url = ConfigurationManager.AppSettings["SiteUrl"].ToString().Trim() + "login";
        public GLogin()
        {
            GoogleConnect.ClientId = clientid;
            GoogleConnect.ClientSecret = clientsecret;
            GoogleConnect.RedirectUri = redirection_url;
        }

        public gplus UserProfile(string code)
        {
            
            string json = GoogleConnect.Fetch("me", code);
            gplus profile = new JavaScriptSerializer().Deserialize<gplus>(json);
            return profile;
        }
    }
}
public class gplus
{
    public string Id { get; set; }
    public string DisplayName { get; set; }
    public Imageg Image { get; set; }
    public List<Email> Emails { get; set; }
}
public class Email
{
    public string Value { get; set; }
    public string Type { get; set; }
}
public class Imageg
{
    public string url { get; set; }
    public bool isDefault { get; set; }
}