import type { UniqueID } from "@repo/rdx-ddd"; import type { Result } from "@repo/rdx-utils"; import type { AccessDefinition } from "../domain/access/access-definition"; import type { MailConfiguration } from "../domain/mail-configuration.aggregate"; import type { MailConfigurationError } from "../domain/mail-configuration-values"; export interface IMailInventoryService { list(companyId: UniqueID): Promise[]>; } export type MailContext = Readonly<{ configurations: readonly MailConfiguration[]; people: readonly Readonly<{ id: UniqueID; active: boolean }>[]; items: readonly Readonly<{ id: UniqueID; values: AccessDefinition }>[]; 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> >; }