<?php
/**
 * Created by PhpStorm.
 * User: qiuzijian
 * Date: 2021-04-23
 * Time: 15:18
 */

namespace Modules\Camera\Enum;

class CameraEnum
{
    //默认流媒体返回id
    const CAMERA_DEFAULT_REVERT_ID = 'NullId';

    //已拉取海康m3u8文件id
    const CAMERA_FILE_EXIST = 'file_exist';

    //流媒体api地址
    const API_STREAM_START = 'api/v1/stream/start';  //启动拉转推
    const API_STREAM_STOP  = 'api/v1/stream/stop';   //停止推流
    const API_PUSHERS      = 'api/v1/pushers';      //获取推流列表

    //m3u8视频文件保存地址
    const M3U8_FILE_PATH = 'files/video/m3u8';

    //m3u8文件名
    const M3U8_FILE_NAME = 'out.m3u8';

    //ts文件后缀
    const TS_FILE_SUFFIX = '*.ts';

    //封面图输出名称
    const COVER_PICTURE_NAME = 'out.png';

    //视频服务器反向代理url
    const VIDEO_AGENCY_URL = 'http://video.nxjiewei.com:8011/';

    //乐橙视频接口配置
    const LECHANGE_APPID     = 'lc753b03152e3b4f1e';
    const LECHANGE_APPSECRET = 'cc9b1224acd24571a5daf18e8c7f94';

    //摄像头类型
    const CAMERA_TYPE_ALL      = 'all';  //全部
    const CAMERA_TYPE_NORMAL   = 1;      //普通
    const CAMERA_TYPE_AREA     = 2;      //关键区域
    const CAMERA_TYPE_WORK     = 3;      //工作面
    const CAMERA_TYPE_MATERIAL = 4;      //物资
    const CAMERA_TYPE_COALYARD = 5;      //煤场

    const CAMERA_TYPE_EXCHANGE = [
        self::CAMERA_TYPE_NORMAL   => '普通摄像头',
        self::CAMERA_TYPE_AREA     => '关键区域监控',
        self::CAMERA_TYPE_WORK     => '工作面监控',
        self::CAMERA_TYPE_MATERIAL => '物资监控',
        self::CAMERA_TYPE_COALYARD => '煤场监控',
    ];

    //调取海康接口类型
    const REQUEST_TYPE_API   = 'api';    //api请求
    const REQUEST_TYPE_LOCAL = 'local';  //本地请求

    //摄像头来源
    const CAMERA_SOURCE_1 = 1;  //硬盘录像机
    const CAMERA_SOURCE_2 = 2;  //视频服务器
    const CAMERA_SOURCE_3 = 3;  //内网摄像头

    const CAMERA_SOURCE_EXCHANGE = [
        self::CAMERA_SOURCE_1 => '硬盘录像机',
        self::CAMERA_SOURCE_2 => '视频服务器',
        self::CAMERA_SOURCE_3 => '内网摄像头',
    ];

    //视频服务器来源
    const VIDEO_RECORDER_HK = 1;  //海康
    const VIDEO_RECORDER_DH = 2;  //大华
    const VIDEO_RECORDER_YS = 3;  //宇视
    const VIDEO_RECORDER_TD = 4;  //天地伟业

    const VIDEO_RECORDER_EXCHANGE = [
        self::VIDEO_RECORDER_HK => '海康',
        self::VIDEO_RECORDER_DH => '大华',
        self::VIDEO_RECORDER_YS => '宇视',
        self::VIDEO_RECORDER_TD => '天地伟业',
    ];

    //乐橙接口url
    const ACCESS_TOKEN_URL = 'https://openapi.lechange.cn:443/openapi/accessToken';  //获取access_token
    const LIVE_LIST_URL    = 'https://openapi.lechange.cn/openapi/liveList';         //获取视频列表

    //乐橙access_token缓存key
    const ACCESS_TOKEN_CACHE_KEY = 'lechange_access_token';

    //乐橙接口返回状态
    const LECHANGE_API_SUCCESS = 0;  //成功

    //海康摄像头默认端口
    const HAK_DEFAULT_PORT = '554';

    //默认排序序号
    const DEFAULT_SORT = 1;

    //摄像头是否显示
    const IS_SHOW_YES = 1;  //显示
    const IS_SHOW_NO  = 2;  //隐藏

    //视频码流
    const CODE_STREAM_SUB  = '1';  //子码流
    const CODE_STREAM_MAIN = '2';  //主码流

    const CODE_STREAM_EXCHANGE = [
        self::CODE_STREAM_SUB  => '子码流',
        self::CODE_STREAM_MAIN => '主码流',
    ];

    //海康视频码流转义
    const CODE_STREAM_HAK = [
        self::CODE_STREAM_SUB  => '1',  //子码流
        self::CODE_STREAM_MAIN => '0',  //主码流
    ];

    const CODE_STREAM_TRANS = [
        self::CODE_STREAM_SUB  => 'sub',
        self::CODE_STREAM_MAIN => 'main',
    ];

    //大华视频码流转义
    const CODE_STREAM_DH = [
        self::CODE_STREAM_SUB  => '1',  //子码流
        self::CODE_STREAM_MAIN => '0',  //主码流
    ];

    //宇视视频码流转义
    const CODE_STREAM_YS = [
        self::CODE_STREAM_SUB  => '1',  //子码流
        self::CODE_STREAM_MAIN => '0',  //主码流
    ];

    //摄像头状态
    const CAMERA_STATUS_ONLINE  = '1';  //在线
    const CAMERA_STATUS_OFFLINE = '2';  //离线
    const CAMERA_STATUS_ERROR   = '3';  //异常

    //天地伟业接口状态
    const TDWY_API_STATUS_CODE_SUCCSS = 'API-COMMON-INF-OK';

    //天地伟业token缓存key
    const TDWY_TOKEN_CACHE = 'tdwy_token';

    //后台摄像头列表每页显示条数
    const PAGE_SIZE = 8;
}