import type { UniqueID } from "@repo/rdx-ddd"; import type { Result } from "@repo/rdx-utils"; import type { MailConfiguration } from "../domain/mail-configuration.aggregate"; import type { MailConfigurationError } from "../domain/mail-configuration-values"; import type { WorkProfile } from "../domain/work-profile.aggregate"; import type { MailboxContext } from "./mailbox.repository"; export interface IMailInventoryService { list(companyId: UniqueID): Promise[]>; } export type MailContext = Readonly<{ configurations: readonly MailConfiguration[]; people: readonly Readonly<{ id: UniqueID; active: boolean }>[]; mailboxes: MailboxContext["mailboxes"]; uses: MailboxContext["uses"]; profiles: readonly WorkProfile[]; assets: readonly Readonly<{ id: UniqueID; available: boolean }>[]; actors: ReadonlyMap; today: string; }>; export interface IMailConfigurationRepository { get(companyId: UniqueID): Promise>; save( companyId: UniqueID, action: (context: MailContext) => Result ): Promise< Result<{ configuration: MailConfiguration; context: MailContext }, MailConfigurationError> >; }