import * as plugins from '../plugins.js';

export type TTemplates = 'default' | 'linkaction' | 'notification';

export interface IReq_SendEmail extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_SendEmail
> {
  method: 'sendEmail';
  request: {
    title: string;
    from: string;
    to: string;
    body: string;
    attachments?: Array<{
      name: string;
      binaryAttachmentString: string;
    }>
  };
  response: {
    /**
     * the response id allows for handling of responses to that email
     */
    responseId: string;
  };
}

export interface IReq_RegisterRecipient extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_RegisterRecipient
> {
  method: 'registerRecepient';
  request: {
    emailAddress: string;
  };
  response: {
    status: 'ok' | 'not ok';
  };
}

export interface IReq_CheckEmailStatus extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_CheckEmailStatus
> {
  method: 'checkEmailStatus';
  request: {
    emailId: string;
  };
  response: {
    status: 'ok' | 'not ok';
  };
}

export interface IReq_GetEMailStats extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_GetEMailStats
> {
  method: 'getEmailStats';
  request: {
    jwt: string;
  };
  response: {
    totalEmailsSent: number;
    totalEmailsDelivered: number;
    totalEmailsBounced: number;
    averageDeliveryTimeMs: number;
    lastUpdated: string;
  };
}