import * as plugins from '../loint-reception.plugins.js';
import { type IUser } from '../data/index.js';

export interface IReq_FirstRegistration
  extends plugins.typedRequestInterfaces.implementsTR<
    plugins.typedRequestInterfaces.ITypedRequest,
    IReq_FirstRegistration
  > {
  method: 'firstRegistrationRequest';
  request: {
    email: string;
    productSlugOfInterest: string;
  };
  response: {
    status: 'ok' | 'not ok';
    testOnlyToken?: string;
  };
}

export interface IReq_AfterRegistrationEmailClicked
  extends plugins.typedRequestInterfaces.implementsTR<
    plugins.typedRequestInterfaces.ITypedRequest,
    IReq_AfterRegistrationEmailClicked
  > {
  method: 'afterRegistrationEmailClicked';
  request: {
    /**
     * the token that has been sent with the registation email to verify access
     */
    token: string;
  };
  response: {
    status: 'ok' | 'not ok';
    /**
     * the email thats associated with the given request token
     */
    email: string;
  };
}

export interface IReq_SetDataForRegistration
  extends plugins.typedRequestInterfaces.implementsTR<
    plugins.typedRequestInterfaces.ITypedRequest,
    IReq_SetDataForRegistration
  > {
  method: 'setDataForRegistration';
  request: {
    token: string;
    userData: IUser['data'];
  };
  response: {
    status: 'ok' | 'not ok';
  };
}

/**
 * Should be used to verify a mobile number for an verifcation
 */
export interface IReq_MobileVerificationForRegistration
  extends plugins.typedRequestInterfaces.implementsTR<
    plugins.typedRequestInterfaces.ITypedRequest,
    IReq_MobileVerificationForRegistration
  > {
  method: 'mobileVerificationForRegistration';
  request: {
    token: string;
    mobileNumber?: string;
    verificationCode?: string;
  };
  response: {
    messageSent?: boolean;
    verficationCodeOk?: boolean;
    testOnlySmsCode?: string;
  };
}

export interface IReq_FinishRegistration
  extends plugins.typedRequestInterfaces.implementsTR<
    plugins.typedRequestInterfaces.ITypedRequest,
    IReq_FinishRegistration
  > {
  method: 'finishRegistration';
  request: {
    token: string;
  };
  response: {
    status: 'ok' | 'not ok';
    userData?: IUser['data'];
  };
}
