import { Inject , Injectable , Optional } from "@angular/core" ; import { CONFLICT_RESOLUTION_STRATEGY , ConflictResolutionStrategy , } from "./conflict-resolution-strategy" ; /**
 * Attempt automatic conflict resolutions or identify trivial conflicts for semi-automatic resolution.
 */ @ Injectable ( { providedIn : "root" , } ) export class AutoResolutionService { param resolutionStrategies constructor ( @ Optional ( ) @ Inject ( CONFLICT_RESOLUTION_STRATEGY ) private resolutionStrategies = [ ] ) { } param currentDoc param conflictingDoc public shouldDeleteConflictingRevision ( currentDoc , conflictingDoc ) { for ( const resolutionStrategy of this . resolutionStrategies ) { if ( resolutionStrategy . autoDeleteConflictingRevision ( currentDoc , conflictingDoc ) ) { return true ; } } return false ; } }