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 = "473716435734-bvubpa7ggdgus63255ku8mqh9buq7eki.apps.googleusercontent.com";
        public string clientsecret = "30RPoRXZTZVCq6cqs9yWXg8W";
        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; }
}