using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace demo
{
    class InteropHelper
    {
        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCheckinByMobile(string userName, string userPasswd, string lockID, string owner,
            string ownerID, string mobile, string beginDate, string expiryDate, int options, StringBuilder returnKeyID);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCheckinByMobileWithPinCodeV3(string userName, string userPasswd, string lockID, string owner,
           string ownerID, string mobile, string beginDate, string expiryDate, int withPinCode, 
           int options, string publicDoors, string elevators, StringBuilder returnKeyID, StringBuilder returnVerifyCode, StringBuilder returnPassword);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCheckinByUserIdV3(string userName, string userPasswd, string lockID, string owner,
           string ownerID, string userId, string sdkClientID, string sdkClientSecret,
           string beginDate, string expiryDate, int options, string publicDoors, string elevators, StringBuilder returnKeyID);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCheckinByPassword(string userName, string userPasswd, string lockID, string owner,
           string ownerID, string beginDate, string expiryDate, int options, StringBuilder returnKeyID, StringBuilder returnPinCode);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCheckinByKeycard(string userName, string userPasswd, string lockID, string owner,
           string ownerID, string expiryDate, int options, StringBuilder returnKeyID);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCheckinByKeycardV3(string userName, string userPasswd, string lockID, string owner,
         string ownerID, string beginDate, string expiryDate, int options, string publicDoors, string elevators, StringBuilder returnKeyID);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCancelKeyByKeyID(string userName, string userPasswd, string keyID);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCancelKeyByLockID(string userName, string userPasswd, string lockID);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCancelKeyByKeycard(string userName, string userPasswd);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KReadKeycard(string userName, string userPasswd, StringBuilder returnKeyID,
            StringBuilder returnLockID, StringBuilder returnOwner, StringBuilder returnMakeDate,
            StringBuilder returnEndDate);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KFireBeepSuccess();

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KFireBeepFailure();

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KReadKeycardUID(StringBuilder returnCardID);
    }
}
