import { Counter } from "../entities" ; export class CounterInteractor { higherBound : number = 10 ; lowerBound : number = 0 ; counter : Counter ; constructor ( startNumber , lowerBound = 0 , higherBound = 10 ) { this . counter = new Counter ( startNumber ) ; this . lowerBound = lowerBound ; this . higherBound = higherBound ; } increment ( qty ? ) { this . counter . increment ( qty ) ; if ( this . counter . count >= this . higherBound ) { this . counter = new Counter ( this . higherBound ) ; } return this . counter ; } decrement ( qty ? ) { this . counter . decrement ( qty ) ; if ( this . counter . count <= this . lowerBound ) { this . counter = new Counter ( this . lowerBound ) ; } return this . counter ; } }