'use strict';
import { getUserId } from '../../../meta/server/auth/users/current-user-id-provider.js';
import { getOneResource } from '../../../meta/server/services/resource-provider.js';
import { resourceNames } from '../../../../fd-toolbox/resources/resource-names.js';
import { isExpired } from '../../../../fd-toolbox/dates/date-time.js';
import { crudDelete } from '../../../meta/server/basic-crud/cruds.js';
import { userFriendlyWorkspaceInviteMessages } from '../../../fd-app-toolbox/constants/user-friendly-workspace-invite-messages.js';

var __defProp=Object['defineProperty'],__name=(_0x4a4b33,_0x2d1978)=>__defProp(_0x4a4b33,'name',{'value':_0x2d1978,'configurable':!![]});async function checkUserWorkspaceInviteCode(_0x2b653e){if(!_0x2b653e)return void(-0x733+-0x1*-0x2169+0x1*-0x1a36);const _0x254236=await getUserWorkspaceInvite(_0x2b653e);let _0x1fbfcd;if(!_0x254236)_0x1fbfcd={'isValid':![]};else isExpired(_0x254236['expirationDate'])?_0x1fbfcd={'isValid':![],'userFriendlyErrorMessage':userFriendlyWorkspaceInviteMessages['expiredInviteCode']}:_0x1fbfcd={'isValid':!![],'workspaceId':_0x254236['workspaceId']};return _0x1fbfcd;}__name(checkUserWorkspaceInviteCode,'checkUserWorkspaceInviteCode');async function deleteUserWorkspaceInvite(_0x2813b4){const _0x1ab9ee={'resourceName':resourceNames['userWorkspaceInvite'],'resourceId':_0x2813b4,'userId':await getUserId()};await crudDelete(_0x1ab9ee);}__name(deleteUserWorkspaceInvite,'deleteUserWorkspaceInvite');async function getUserWorkspaceInvite(_0x1ad430){const _0x5a64e7={'resourceName':resourceNames['userWorkspaceInvite'],'id':_0x1ad430,'disableGlobalWorkspaceFilter':!![]};return getOneResource(_0x5a64e7);}__name(getUserWorkspaceInvite,'getUserWorkspaceInvite');

export { checkUserWorkspaceInviteCode, deleteUserWorkspaceInvite };
