import type { UnknownMessageContent } from './message.ts' import type { Identity } from './node.ts' /* Impl ref: https://github.com/takenet/lime-csharp/blob/master/src/Lime.Messaging/Resources/Presence.cs */ export type Presence = { status: 'unavailable' | 'available' | 'busy' | 'away' | 'invisible' /** * Rule to the server route envelopes addressed to the identity * - Instance Routing: Strict match on full node, including instance. * - Identity Routing: Matches full node or base identity (no instance). * - Promiscuous Identity: Matches base identity or any instance variation. */ routingRule: 'instance' | 'identity' /** The date of the last known presence status for the node */ lastSeen: string /** If true, indicates that the delivery of envelopes for the current session should be distributed by using the round-robin strategy between the resolved routes with this setting */ roundRobin?: boolean /** If true, indicates that the instance should be ignored in the routing rules */ promiscuous?: boolean /** If true, indicates that the current session should receive the messages sent by itself */ echo?: boolean /** The priority of the presence, higher means more priority */ priority?: number /** * Present instances for a identity * Instances starting with a ! indicate that it can be overriden, so when a new connection is made for the same instance, the previous session will be closed. * Instances starting with a # indicate that it cannot be overriden, so when a new connection is made for the same instance, it will fail. */ instances: Array } export type Account = { identity: Identity fullName: string email?: Identity phoneNumber?: string photoUri?: string // When the culture is missing, it should default to pt-BR culture?: string extras?: Record creationDate: string } export type BlipLanguage = 'en' | 'pt' | 'es' export type Tenant = { canViewMobileDesk: boolean creationDate: string creationSource: string id: string isTestContract: boolean name: string ownerIdentity: string paymentAccount?: string photoUri?: string } export type Contact = { identity: Identity name?: string group?: string city?: string email?: string phoneNumber?: string source?: string taxDocument?: string extras?: Record lastMessageDate?: string } export type ThreadItem = { id: string direction: 'sent' | 'received' date: string status: string reason?: { code: number description: string } metadata?: Record } & UnknownMessageContent export type Comment = { id: Identity storageDate: string authorIdentity: Identity content: string } export type AccessKey = { id: string account: Identity purpose?: string expiration?: string requirer: string temporary: boolean creationDate: string key: string }