using Hotline.Share.Dtos.CallCenter;
using Hotline.Share.Enums.CallCenter;
using SqlSugar;
using XF.Domain.Entities;
using XF.Domain.Repository;

namespace Hotline.CallCenter.Ivrs;

/// <summary>
/// IVR语音导航节点
/// </summary>
public class Ivr : CreationEntity
{
    /// <summary>
    /// IVR类型
    /// </summary>
    public EIvrType IvrType { get; set; }

    /// <summary>
    /// 语音菜单编号（讯时设备MenuId,1-50，不可重复）
    /// </summary>
    [SugarColumn(ColumnDescription = "菜单编号")]
    public string No { get; set; }

    public string Voice { get; set; }

    /// <summary>
    /// 语音播放次数, 0-50, 0表示循环
    /// </summary>
    public int Repeat { get; set; }

    /// <summary>
    /// 按键检测长度，1-255（一字节长度）
    /// </summary>
    public int InfoLength { get; set; } = 1;

    /// <summary>
    /// 按键结束符
    /// </summary>
    [SugarColumn(ColumnDescription = "按键结束符", IsNullable = true)]
    public string? Exit { get; set; }

    /// <summary>
    /// 上一个语音菜单
    /// </summary>
    [SugarColumn(ColumnDescription = "上一个语音菜单", IsNullable = true)]
    public string? PrevIvrNo { get; set; }

    /// <summary>
    /// 每个IVR分类中有且只有一个根节点
    /// </summary>
    public bool IsRoot { get; set; }

    /// <summary>
    /// 名称
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// Ivr分类Id
    /// </summary>
    public string IvrCategoryId { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [SugarColumn(IsNullable = true)]
    public string? Remark { get; set; }

    /// <summary>
    /// IVR策略
    /// </summary>
    [SugarColumn(ColumnDataType = "json", IsJson = true)]
    public List<IvrStrategy> IvrStrategies { get; set; } = new();

    [SugarColumn(IsIgnore = true)]
    public static string Key => $"Ivrs";
}