
class BufferedPersonScanner extends PersonScanner {

	/**
	 * @param int sfxCount
	 * @param obj people Structure: { <personRef>: {'surname':<str>, 'forenames':<str>, id:<int>} }
	 * @returns {BufferedPersonScanner}
	 */
	constructor(sfxCount, people) {
		super(sfxCount);	
		this.people = people;
	}
	
	validateScan(qrContent) {
		
		var validation = super.validateScan(qrContent);
		
		if (!this.people.hasOwnProperty(qrContent)) {
			validation.valid = false;
			validation.message = 'QR Code not recognised';
		}
		
		return validation;
	}
	
	// [Override]
	processScan(personRef) {
		
		this.onSuccessfulScan(
			personRef,
			this.people[personRef]['forenames']+', '+this.people[personRef]['surname'],
		);
	}
}