import { DomainEvent , IDomainEvent } from '@centsideas/event-sourcing' ; import { AuthenticationEventNames } from '@centsideas/enums' ; import { SessionModels } from '@centsideas/models' ; import { Timestamp , UserId , SessionId , Email } from '@centsideas/types' ; @ DomainEvent ( AuthenticationEventNames . GoogleSignInConfirmed ) export class GoogleSignInConfirmed implements IDomainEvent { constructor ( public readonly sessionId , public readonly userId , public readonly email , public readonly isSignUp , public readonly requestedAt , public readonly confirmedAt ) { } serialize ( ) { return { sessionId : this . sessionId . toString ( ) , userId : this . userId . toString ( ) , email : this . email . toString ( ) , isSignUp : this . isSignUp , requestedAt : this . requestedAt . toString ( ) , confirmedAt : this . confirmedAt . toString ( ) , } ; } static deserialize ( { sessionId , userId , email , isSignUp , requestedAt , confirmedAt , } ) { return new GoogleSignInConfirmed ( SessionId . fromString ( sessionId ) , UserId . fromString ( userId ) , Email . fromString ( email ) , isSignUp , Timestamp . fromString ( requestedAt ) , Timestamp . fromString ( confirmedAt ) ) ; } }