/**
 * Copyright (c) 2021,Zhejiang @hua
 * All rights reserved.
 *
 * file name:SDKDefine.cs
 *
 * version:1.0
 * author:27401
 * date:2021-6-18
 * history:create
*/

using System;
using System.Collections.Generic;
using System.Text;

namespace DPSDK_CSharpDemo
{

    // Base request parameter
    class BaseRequest
    {
        public bool bEmptyBody = true;                  // Is body empty,the corresponding structure type can be passed as String
        public bool bEmptyUrlParam = true;              // Is Url parameter empty,the corresponding structure type can be passed as String
        public bool bHeadToken = false;                 // Is request head with token,V7=false,V8=true
        public string strUri = string.Empty;            // Request url,without ip port and url parameter
        public string strMethod = "POST";               // Request method
        public int iTimeout = 10000;                    // Timeout
    }

    // ProV7 request body structure
    class BaseProV7Request<T>
    {
        public string clientType = "WINPC_V2";          
        public string clientMac = string.Empty;         
        public string clientPushId = string.Empty;      
        public string project = "PSDK";                 
        public string method = string.Empty;
        public T data;                                 
    }

    // The data field in the ProV7 request body structure,each protocol is redefined by itself
    class BaseProV7RequestData
    {
        public string optional = string.Empty;
    }

    // ProV8 request structure
    class BaseProV8Request<T1, T2>
    {
        public T1 urlParam;
        public T2 data;
    }

    // Response body structure
    class BaseResponse<T>
    {
        public int code = 0;
        public string desc = string.Empty;
        public T data;
    }

    /*Get MQ config*/
    // The data field of get MQ config response
    class GetMQConfigResponseData
    {
        public string password = string.Empty;          //password
        public string addr = string.Empty;              //IP:Port, openwire protocol
        public string mqtt = string.Empty;              //IP:Port, mqtt protocol
        public string enableTls = string.Empty;         //Is enable TLSŁ¬0=noŁ¬1=yes
        public string userName = string.Empty;          //user name
    }

    /*Get page users*/
    // Get page users url parameter
    class GetPageUsersUrlParam
    {
        public String page = string.Empty;              //Page,required
        public String pageSize = string.Empty;          //Page size,required
        public String roleIds = string.Empty;           //Role ID,multiple are separated by commas,optional
        public String username = string.Empty;          //User name,support fuzzy search,optional
        public String online = string.Empty;            //Online status:0=offline,1=online,optional
        public String userType = string.Empty;          //User type:0=common,1=domain,optional
    }
    // User role information
    class UserRoleInfo
    {
        public String roleId = string.Empty;            //Role ID
        public String roleName = string.Empty;          //Role name
    }
    // Get page users response page data
    class GetPageUsersResponsePageData
    {
        public String id = string.Empty;                //User ID
        public String username = string.Empty;          //User name
        public String online = string.Empty;            //Online status:0=offline,1=online
        public String userType = string.Empty;          //User type:0=common,1=domain
        public String status = string.Empty;            //User status:1=unfreeze,0=freeze
        public List<UserRoleInfo> roles = new List<UserRoleInfo>();
    }
    // Get page users response data
    class GetPageUsersResponseData
    {
        public String totalCount = string.Empty;        //Total count
        public List<GetPageUsersResponsePageData> pageData = new List<GetPageUsersResponsePageData>();
    }
    // OrgCode info
    class OrgCodesInfo
    {
        public String orgCode = string.Empty;         // OrgCode        
        public String autoAuthorize = string.Empty;   // Automatic authorization of descendant nodes: 0 = no, 1 = yes     
    }
    // Add role request data
    class AddRoleRequestData
    {
        public String roleName = string.Empty;                 // role name
        public String memo = string.Empty;                     // memo
        public List<String> channelIds = new List<String>();   // channel ids
        public List<String> deviceCodes = new List<String>();  // device codes
        public List<String> menuCodes = new List<String>();    // menu codes
        public List<String> functionCodes = new List<String>();             // function codes
        public List<OrgCodesInfo> orgCodes = new List<OrgCodesInfo>();      // org codes
    }
    class AddRoleResponseData
    {
        public String id = string.Empty;                     // role id
    }
    class DeleteRolesRequestUrlParam
    {
        public String ids = string.Empty;                   // role ids
    }
    // Failed Roles Info
    class FailedRolesInfo
    {
        public String id = string.Empty;              // role id
        public String roleName = string.Empty;        // role name
    }
    // Delete Roles Response Data
    class DeleteRolesResponseData
    {
        public List<FailedRolesInfo> failedRoles = new List<FailedRolesInfo>();
    }
    // Get Role Response Data
    class GetRoleResponseData
    {
        public String allowEdit = string.Empty;      // Allow editing: 0 = no, 1 = yes
        public String id = string.Empty;             // role id
        public String roleName = string.Empty;       // role name
        public String memo = string.Empty;           // memo
        public List<String> functionsCodes = new List<String>();    // functions Codes
        public List<String> menuCodes = new List<String>();         // menu Codes
    }
    // Role Results Info
    class RoleResultsInfo
    {
        public String id = string.Empty;              // role id
        public String allowEdit = string.Empty;       // Allow editing: 0 = no, 1 = yes
        public String roleName = string.Empty;        // role name
        public String memo = string.Empty;            // memo
    }
    // Get Roles Response Data
    class GetRolesResponseData
    {
        public List<RoleResultsInfo> results = new List<RoleResultsInfo>();
    }
    // Change Channel Ids Info
    class ChangeChannelIdsInfo
    {
        public List<String> addChannelIds = new List<String>();     // add Channel Ids
        public List<String> deleteChannelIds = new List<String>();  // delete Channel Ids
    }
    // Change OrgCodes Info
    class ChangeOrgCodesInfo
    {
        public List<String> deleteOrgCodes = new List<String>();                   // delete OrgCodes
        public List<OrgCodesInfo> updateOrgCodes = new List<OrgCodesInfo>();       // update OrgCodes
    }
    // Change DeviceCodes Info
    class ChangeDeviceCodesInfo
    {
        public List<String> deleteDeviceCodes = new List<String>();     // delete Device Codes
        public List<String> addDeviceCodes = new List<String>();        // add DeviceCodes
    }
    // Update RoleRequest Data
    class UpdateRoleRequestData
    {
        public String roleName = string.Empty;                                              // role name
        public String memo = string.Empty;                                                  // memo
        public ChangeChannelIdsInfo changeChannelIds = new ChangeChannelIdsInfo();          // change Channel Ids
        public ChangeOrgCodesInfo changeOrgCodes = new ChangeOrgCodesInfo();                // change Org Codes
        public ChangeDeviceCodesInfo changeDeviceCodes = new ChangeDeviceCodesInfo();       // change Device Codes
        public List<String> menuCodes = new List<String>();                                 // menu Codes
        public List<String> functionCodes = new List<String>();                             // function Codes
    }
    // Add user request data
    class AddUserRequestData
    {
        public String username = string.Empty;                       // user name, required
        public String password = string.Empty;                       // password, required
        public String enableMPT = string.Empty;                      // Whether MTP login is supported, 0= no, 1= yes, optional, 0 by default
        public String name = string.Empty;                           // Nickname, required when supporting MPT login
        public String enableExpireDate = string.Empty;               // Enable user validity verification: 1 = yes, 0 = no, required
        public String expireDate = string.Empty;                     // User validity period (timestamp)
        public String enableMacAddresses = string.Empty;             // Enable MAC address verification: 1 = yes, 0 = no, required
        public List<String> macAddresses = new List<String>();       // macAddresses
        public String memo = string.Empty;                           // memo
        public String email = string.Empty;                          // email
        public String ptzLevel = string.Empty;                       // PTZ level, required
        public String enablePasswordValidity = string.Empty;         // Enable password validity verification: 1 = yes, 0 = no, required
        public String passwordValidity = string.Empty;               // password Validity
        public String forceResetPassword = string.Empty;             // Forced password modification: 1 = yes, 0 = no, required
        public String reuse = string.Empty;                          // Support multi sign on: 1 = yes, 0 = no, required
        public String status = string.Empty;                         // User status: 1 = unfreeze, 0 = freeze, required
        public List<String> roleIds = new List<String>();            // roleIds, required
        public String policeCode = string.Empty;                     // police code
        public String policeType = string.Empty;                     // police type
        public String tel = string.Empty;                            // tel
    }
    // Add user response data
    class AddUserResponseData
    {
        public String id = string.Empty;                             // user id
    }
    // Delete User Request Data
    class DeleteUserRequestUrlParam
    {
        public String ids = string.Empty;                             // user ids
    }
    // Get User Response Data
    class GetUserResponseData
    {
        public String ptzLevel = string.Empty;                // PTZ control authority
        public String enableMacAddresses = string.Empty;      // Enable MAC address verification: 1 = yes, 0 = no
        public String id = string.Empty;                      // user id
        public String passwordValidity = string.Empty;        // Password validity (days)
        public String enableExpireDate = string.Empty;        // Enable user validity verification: 1 = yes, 0 = no
        public String username = string.Empty;                // user name
        public String reuse = string.Empty;                   // Support multi sign on: 1 = yes, 0 = no
        public String expireDate = string.Empty;              // User validity period (timestamp)
        public String forceResetPassword = string.Empty;      // Forced password modification: 1 = yes, 0 = no
        public String status = string.Empty;                  // User status: 1 = unfreeze, 0 = freeze
        public String enablePasswordValidity = string.Empty;  // Enable password validity verification: 1 = yes, 0 = no
        public String email = string.Empty;                   // email
        public String memo = string.Empty;                    // memo
        public List<String> macAddresses = new List<String>();                 // macAddresses
        public List<UserRoleInfo> roles = new List<UserRoleInfo>();            // roles
    }
    // User Results Info
    class UserResultsInfo
    {
        public String username = string.Empty;      // user name
        public String online = string.Empty;        // Online status: 0 = offline, 1 = Online
        public String id = string.Empty;            // user id
        public String status = string.Empty;        // User status: 1 = unfreeze, 0 = freeze
        public String userType = string.Empty;      // User type: 0 = ordinary user, 1 = domain user
    }
    class GetUsersRequestUrlParam
    {
        public String username = string.Empty;       // user name
    }
    // Get Users Response Data
    class GetUsersResponseData
    {
        public List<UserResultsInfo> results = new List<UserResultsInfo>();            // UserResults
    }
    // Update User Request Data
    class UpdateUserRequestData
    {
        //public String username = string.Empty;                       // user name, required
        public String password = string.Empty;                       // password, required
        public String enableMPT = string.Empty;                      // Whether MTP login is supported, 0= no, 1= yes, optional, 0 by default
        public String name = string.Empty;                           // Nickname, required when supporting MPT login
        public String enableExpireDate = string.Empty;               // Enable user validity verification: 1 = yes, 0 = no, required
        public String expireDate = string.Empty;                     // User validity period (timestamp)
        public String enableMacAddresses = string.Empty;             // Enable MAC address verification: 1 = yes, 0 = no, required
        public List<String> macAddresses = new List<String>();       // macAddresses
        public String memo = string.Empty;                           // memo
        public String email = string.Empty;                          // email
        public String ptzLevel = string.Empty;                       // PTZ level, required
        public String enablePasswordValidity = string.Empty;         // Enable password validity verification: 1 = yes, 0 = no, required
        public String passwordValidity = string.Empty;               // password Validity
        public String forceResetPassword = string.Empty;             // Forced password modification: 1 = yes, 0 = no, required
        public String reuse = string.Empty;                          // Support multi sign on: 1 = yes, 0 = no, required
        public String status = string.Empty;                         // User status: 1 = unfreeze, 0 = freeze, required
        public List<String> roleIds = new List<String>();            // roleIds, required
        public String policeCode = string.Empty;                     // police code
        public String policeType = string.Empty;                     // police type
        public String tel = string.Empty;                            // tel
}



}
