package com.ruoyi.cai.ws.constant;

import lombok.Getter;

@Getter
public enum RoomStatusEnums {

    /**
     * 刚创建
     */
    STATUS_CREATE(0,"刚创建"),
    /**
     * 呼叫方连接上
     */
    STATUS_CALLER_CONNECT(1,"呼叫方连接上"),
    /**
     * 呼叫方取消通话
     */
    STATUS_CALLER_CANCEL(2,"呼叫方取消通话"),
    /**
     * 接收方连接上
     */
    STATUS_RECEIVER_CONNECT(3,"接收方连接上"),
    /**
     * 收到通话未接听
     */
    STATUS_CONNECT_CANCEL(4,"收到通话未接听"),
    /**
     * 超时未接听
     */
    STATUS_TIMEOUT_CANCEL(5,"超时未接听"),
    /**
     * 接收方已拒绝
     */
    STATUS_REFUSE(6,"接收方已拒绝"),
    /**
     * 已接听
     */
    STATUS_AGREE(7,"已接听"),
    /**
     * 通话结束
     */
    STATUS_HANGUP(8,"通话结束")
    ;

    private final Integer code;
    private final String name;

    RoomStatusEnums(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static boolean isCanCall(Integer status){
        if(STATUS_CREATE.getCode().equals(status)
            || STATUS_CALLER_CONNECT.getCode().equals(status)
            || STATUS_RECEIVER_CONNECT.getCode().equals(status)
            || STATUS_AGREE.getCode().equals(status)){
            return true;
        }
        return false;
    }

}
