using System.Net;
using ChatController.Utils;

namespace ChatController.Data
{
    internal static class WebRequestBuilder
    {
        public static string ServerUrl { get; set; }
        public static string ApiKey { get; set; }
        public static string CustomerId { get; set; }

        public static WebRequest Build(string pUrl)
        {
            var request = WebRequest.Create(ServerUrl + pUrl);
            request.Headers[Constants.Token] = ApiKey;
            request.Headers[Constants.CustomerId] = CustomerId;

            request.Credentials = CredentialCache.DefaultCredentials;
            request.Proxy = null;

            return request;
        }

        public static WebRequest Build(string pServerUrl, string pUrl, string pCustomerId, string pToken)
        {
            var request = WebRequest.Create(pServerUrl + pUrl);
            request.Headers[Constants.Token] = pToken;
            request.Headers[Constants.CustomerId] = pCustomerId;

            request.Credentials = CredentialCache.DefaultCredentials;
            request.Proxy = null;

            return request;
        }
    }
}
