// Path: commons-eid-client/src/main/java/be/bosa/commons/eid/client/CancelledException.java
// public class CancelledException extends BeIDCardsException {
// }
// 
// Path: commons-eid-client/src/main/java/be/bosa/commons/eid/client/PINPurpose.java
// public enum PINPurpose {
// 	PINTest("test"),
// 	AuthenticationSignature("authentication"),
// 	NonRepudiationSignature("nonrepudiation");
// 
// 	private final String type;
// 
// 	PINPurpose(final String type) {
// 		this.type = type;
// 	}
// 
// 	public String getType() {
// 		return this.type;
// 	}
// 
// 	/**
// 	 * Determine the likely reason for a PIN request by checking the certificate
// 	 * chain involved.
// 	 *
// 	 * @param fileType the File on the BeID that is involved in the operation
// 	 * @return the PIN Purpose associated with this type of file
// 	 */
// 	public static PINPurpose fromFileType(final FileType fileType) {
// 		switch (fileType) {
// 			case AuthentificationCertificate:
// 				return AuthenticationSignature;
// 			case NonRepudiationCertificate:
// 				return NonRepudiationSignature;
// 			default:
// 				return PINTest;
// 		}
// 	}
// }


import be.bosa.commons.eid.client.CancelledException;
import be.bosa.commons.eid.client.PINPurpose;
import java.util.Locale;
/*
 * Commons eID Project.
 * Copyright (C) 2014 - 2018 BOSA.
 *
 * This is free software; you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License version 3.0 as published by
 * the Free Software Foundation.
 *
 * This software is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this software; if not, see https://www.gnu.org/licenses/.
 */

package be.bosa.commons.eid.client.spi;



/**
 * Implement a BeIDCardUI to interact with the user from a BeIDCard instance.
 *
 * @author Frank Marien
 */
public interface BeIDCardUI {
	/**
	 * set Locale for subsequent operations. Implementations MUST ensure that
	 * after this call, any of the other methods for the same instance respect
	 * the locale set here. Implementations MAY choose to update any interface
	 * elements already facing the user at time of call, but this is not
	 * required.
	 */
	void setLocale(Locale newLocale);

	/**
	 * get the Locale currently set.
	 *
	 * @return the current Locale for this UI
	 */
	Locale getLocale();

	/**
	 * get PIN from the user
	 *
	 * @param triesLeft the number of attempts left before the PIN is blocked.
	 * @param type      the reason why the PIN code is requested
	 * @return the PIN code.
	 * @throws CancelledException thrown in case the user cancels the PIN entry.
	 */
// Path: commons-eid-client/src/main/java/be/bosa/commons/eid/client/CancelledException.java
// public class CancelledException extends BeIDCardsException {
// }
// 
// Path: commons-eid-client/src/main/java/be/bosa/commons/eid/client/PINPurpose.java
// public enum PINPurpose {
// 	PINTest("test"),
// 	AuthenticationSignature("authentication"),
// 	NonRepudiationSignature("nonrepudiation");
// 
// 	private final String type;
// 
// 	PINPurpose(final String type) {
// 		this.type = type;
// 	}
// 
// 	public String getType() {
// 		return this.type;
// 	}
// 
// 	/**
// 	 * Determine the likely reason for a PIN request by checking the certificate
// 	 * chain involved.
// 	 *
// 	 * @param fileType the File on the BeID that is involved in the operation
// 	 * @return the PIN Purpose associated with this type of file
// 	 */
// 	public static PINPurpose fromFileType(final FileType fileType) {
// 		switch (fileType) {
// 			case AuthentificationCertificate:
// 				return AuthenticationSignature;
// 			case NonRepudiationCertificate:
// 				return NonRepudiationSignature;
// 			default:
// 				return PINTest;
// 		}
// 	}
// }


// Path: commons-eid-client/src/main/java/be/bosa/commons/eid/client/spi/BeIDCardUI.java
import be.bosa.commons.eid.client.CancelledException;
import be.bosa.commons.eid.client.PINPurpose;
import java.util.Locale;

/*
 * Commons eID Project.
 * Copyright (C) 2014 - 2018 BOSA.
 *
 * This is free software; you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License version 3.0 as published by
 * the Free Software Foundation.
 *
 * This software is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this software; if not, see https://www.gnu.org/licenses/.
 */

package be.bosa.commons.eid.client.spi;



/**
 * Implement a BeIDCardUI to interact with the user from a BeIDCard instance.
 *
 * @author Frank Marien
 */
public interface BeIDCardUI {
	/**
	 * set Locale for subsequent operations. Implementations MUST ensure that
	 * after this call, any of the other methods for the same instance respect
	 * the locale set here. Implementations MAY choose to update any interface
	 * elements already facing the user at time of call, but this is not
	 * required.
	 */
	void setLocale(Locale newLocale);

	/**
	 * get the Locale currently set.
	 *
	 * @return the current Locale for this UI
	 */
	Locale getLocale();

	/**
	 * get PIN from the user
	 *
	 * @param triesLeft the number of attempts left before the PIN is blocked.
	 * @param type      the reason why the PIN code is requested
	 * @return the PIN code.
	 * @throws CancelledException thrown in case the user cancels the PIN entry.
	 */
	char[] obtainPIN(int triesLeft, PINPurpose type) throws CancelledException;