using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace Wex.Sdk
{
    public partial interface IWexClient
    {
        /// <summary>
        /// 执行操作呼叫中心请求
        /// </summary>
        /// <typeparam name="TRequest"></typeparam>
        /// <typeparam name="TResponse"></typeparam>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<TResponse?> ExecuteAsync<TRequest, TResponse>(
            TRequest request,
            CancellationToken cancellationToken) where TRequest : IWexRequest where TResponse : WexResponse;

        Task<WexToken> GetTokenAsync(TokenRequest request, CancellationToken cancellationToken);
    }

    public class WexResponse
    {
        public string Msg { get; set; }

        public int Code { get; set; }
    }

    public class WexResponse<TData> : WexResponse
    {
        public TData Data { get; set; }
    }


    public class WexResponsePage<TData>: WexResponse<TData>
    {
        public int Count { get; set; }
    }


    public interface IWexRequest
    {
        [JsonIgnore]
        string Url { get; }
    }
}
