import { ClaimKey } from '@coinweb/contract-kit';

export type LockedKey = Omit<ClaimKey, 'second_part'> & Partial<Pick<ClaimKey, 'second_part'>>;

export type MutexLockState = {
  locked: boolean;
  keys: LockedKey[];
  processId: string;
};

export enum MutexAccessStatus {
  GRANTED = 'granted',
  DENIED = 'denied',
}

export type MutexAccessResult = {
  status: MutexAccessStatus;
};

export type MutexGetAccessArgs = [claimKey: ClaimKey, processId: string, uniqueId: string];

export type MutexUnlockArgs = [lockId: string, timestamp: number];
