using Hotline.Share.Requests;

namespace Hotline.CallCenter.Calls
{
    public interface ICallDomainService
    {

        #region 来电
        /// <summary>
        /// 来电转分机
        /// </summary>
        /// <returns></returns>
        Task VisitorToTelAsync(VisitorIdToTelRequest request, CancellationToken cancellationToken);

        /// <summary>
        /// 来电转外线
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task VisitorToOuterAsync(VisitorToOuterRequest request, CancellationToken cancellationToken);

        /// <summary>
        /// 来电转IVR
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task VisitorToIvrAsync(VisitorToIvrRequest request, CancellationToken cancellationToken);

        /// <summary>
        /// 来电转分机组
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task VisitorToTelGroupAsync(VisitorToTelGroupRequest request, CancellationToken cancellationToken);


        #endregion

        #region 去电

        /// <summary>
        /// 分机呼外部电话
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task ExtToOuterAsync(ExtToOuterRequest request, CancellationToken cancellationToken);

        #endregion

        #region 来电受理

        /// <summary>
        /// 来电受理
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task AcceptVisitorAsync(AcceptVisitorRequest request, CancellationToken cancellationToken);

        #endregion

        #region 监听和插播

        /// <summary>
        /// 监听分机
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task MonitorExt(MonitorExtRequest request, CancellationToken cancellationToken);

        /// <summary>
        /// 从监听到插播状态变换
        /// 1. 已知：分机 A 在监听分机 B 与其通话方的通话；
        /// 2. 执行分机 A 的从监听到插播状态变换的 API；
        /// 3. 执行成功时，分机 A 与分机 B 建立通话，分机 B 的原通话方听保持音。
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task MonitorExtToTalk(MonitorExtToTalkRequest request, CancellationToken cancellationToken);

        /// <summary>
        /// 从插播到监听状态变换
        /// 1. 已知：分机 A 在插播分机 B 的通话；
        /// 2. 执行分机 A 的从插播到监听状态变换的 API；
        /// 3. 执行成功时，分机 A 监听分机 B 及其原通话方的通话。
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task MonitorExtToListen(MonitorExtToListenRequest request, CancellationToken cancellationToken);
        #endregion

        #region 强插

        /// <summary>
        /// 强插
        /// 1. 已知：分机 A 当前空闲，分机 B 正在通话中；
        /// 2. 执行分机 A 强插分机 B 的 API；
        /// 3. 执行成功时，分机 A 振铃，摘机后即可形成三方通话。
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task BargeinExt(BargeinExtRequest request, CancellationToken cancellationToken);

        #endregion

        #region 电话评价
        /// <summary>
        /// 根据OrderId 获取电话评价
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        Task<CallNative?> GetByOrderIdAsync(string orderId);
        #endregion
    }
}
