using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace CryptoExchange.Net.Interfaces
{
    /// <summary>
    /// Request interface
    /// </summary>
    public interface IRequest
    {
        /// <summary>
        /// Accept header
        /// </summary>
        MediaTypeWithQualityHeaderValue Accept { set; }
        /// <summary>
        /// Content
        /// </summary>
        string? Content { get; }
        /// <summary>
        /// Method
        /// </summary>
        HttpMethod Method { get; set; }
        /// <summary>
        /// Uri
        /// </summary>
        Uri Uri { get; }
        /// <summary>
        /// HTTP protocol version
        /// </summary>
        Version HttpVersion { get; }
        /// <summary>
        /// internal request id for tracing
        /// </summary>
        int RequestId { get; }
        /// <summary>
        /// Set byte content
        /// </summary>
        /// <param name="data"></param>
        void SetContent(byte[] data);
        /// <summary>
        /// Set string content
        /// </summary>
        void SetContent(string data, Encoding? encoding, string contentType);

        /// <summary>
        /// Add a header to the request
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        void AddHeader(string key, string value);

        /// <summary>
        /// Get all headers
        /// </summary>
        /// <returns></returns>
        HttpRequestHeaders GetHeaders();

        /// <summary>
        /// Get the response
        /// </summary>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<IResponse> GetResponseAsync(CancellationToken cancellationToken);
    }
}
