#ifndef HEADER_APDU_TEST_H
#define HEADER_APDU_TEST_H


///////////// CPDU /////////////

// CREATE_SS_ENTRY
#define CREATE_SS_ENTRY_CLA 0x80
#define CREATE_SS_ENTRY_INS 0xE0
#define CREATE_SS_ENTRY_P1 0x00
#define CREATE_SS_ENTRY_P2 0x00
#define CREATE_SS_ENTRY_LE 0x02

// DELETE_SS_ENTRY
#define DELETE_SS_ENTRY_CLA 0x80
#define DELETE_SS_ENTRY_INS 0xE4

// SELECT_SS_ENTRY
#define SELECT_SS_ENTRY_CLA 0x80
#define SELECT_SS_ENTRY_INS 0xA5
#define SELECT_SS_ENTRY_P1_ID 0x00
#define SELECT_SS_ENTRY_P1_FIRST 0x01
#define SELECT_SS_ENTRY_P1_NEXT 0x02
#define SELECT_SS_ENTRY_P2 0x00
#define SELECT_SS_ENTRY_LC_ID 0x02
#define SELECT_SS_ENTRY_LE 0x00

// PUT_SS_ENTRY
#define PUT_SS_ENTRY_CLA 0x80
#define PUT_SS_ENTRY_INS 0xDA
#define PUT_SS_ENTRY_P1_SIZE 0x00
#define PUT_SS_ENTRY_P1_FIRST 0x01
#define PUT_SS_ENTRY_P1_NEXT 0x02
#define PUT_SS_ENTRY_P2_PRIVATE 0x00
#define PUT_SS_ENTRY_P2_PUBLIC 0x80

// GET_SS_ENTRY
#define GET_SS_ENTRY_CLA 0x80
#define GET_SS_ENTRY_INS 0xCA
#define GET_SS_ENTRY_P1_SIZE 0x00
#define GET_SS_ENTRY_P1_FIRST 0x01
#define GET_SS_ENTRY_P1_NEXT 0x02
#define GET_SS_ENTRY_P2 0x00
#define GET_SS_ENTRY_LE 0x00

// GET_SS_ENTRY_ID
#define GET_SS_ENTRY_ID_CLA 0x80
#define GET_SS_ENTRY_ID_INS 0xB2
#define GET_SS_ENTRY_ID_P1 0x00
#define GET_SS_ENTRY_ID_P2 0x00
#define GET_SS_ENTRY_ID_LE 0x02

// DELETE_ALL_SS_ENTRY
#define DELETE_ALL_SS_ENTRY_CLA 0x80
#define DELETE_ALL_SS_ENTRY_INS 0xE5
#define DELETE_ALL_SS_ENTRY_P1 0x00
#define DELETE_ALL_SS_ENTRY_P2 0x00

// SET_ACTIVE_INTERFACE
#define SET_ACTIVE_INTERFACE_CLA 0x80
#define SET_ACTIVE_INTERFACE_INS 0xF6
#define SET_ACTIVE_INTERFACE_P1_SPI 0x00
#define SET_ACTIVE_INTERFACE_P2_SPI 0x00
#define SET_ACTIVE_INTERFACE_P1_ALL 0x00
#define SET_ACTIVE_INTERFACE_P2_ALL 0x01

// SESSION_CHALLENGE
#define SESSION_CHALLENGE_CLA 0x00
#define SESSION_CHALLENGE_INS 0xF9
#define SESSION_CHALLENGE_P1 0x00
#define SESSION_CHALLENGE_P2 0x00
#define SESSION_CHALLENGE_LE 0x20

// START_SECURE_SESSION
#define START_SECURE_SESSION_CLA 0x80
#define START_SECURE_SESSION_INS 0xF7
#define START_SECURE_SESSION_P1 0x00
#define START_SECURE_SESSION_P2 0x00
#define START_SECURE_SESSION_LE 0x10

// STOP_SECURE_SESSION
#define STOP_SECURE_SESSION_CLA 0x80
#define STOP_SECURE_SESSION_INS 0xF8
#define STOP_SECURE_SESSION_P1 0x00
#define STOP_SECURE_SESSION_P2 0x00

// SELECT_COMMAND
#define SELECT_COMMAND_CLA 0x00
#define SELECT_COMMAND_INS 0xA4
#define SELECT_COMMAND_P1 0x04
#define SELECT_COMMAND_P2 0x00
#define SELECT_COMMAND_LE 0x02


///////////// RPDU /////////////
#define RES_OK_SW1 0x90 // Incorrect values in the command data.
#define RES_OK_SW2 0x00 // Incorrect values in the command data.



#define RES_INCORRECT_VALUE_SW1 0x6A // Incorrect values in the command data.
#define RES_INCORRECT_VALUE_SW2 0x80 // Incorrect values in the command data.

#define RES_SECURITY_STATUS_NOT_SATISFIED_SW1 0x69 // Security status not satisfied.
#define RES_SECURITY_STATUS_NOT_SATISFIED_SW2 0x82 // Security status not satisfied.

#define RES_WRONG_LENGH_IN_LC_SW1 0x67 // Wrong length in LC
#define RES_WRONG_LENGH_IN_LC_SW2 0x00 // Wrong length in LC

#define RES_INCORRECT_P1P2_SW1 0x6A // Incorrect P1 P2
#define RES_INCORRECT_P1P2_SW2 0x86 // Incorrect P1 P2

#define RES_INVALID_INS_SW1 0x6D // Invalid instruction
#define RES_INVALID_INS_SW2 0x00 // Invalid instruction

#define RES_INVALID_CLA_SW1 0x6E // Invalid class
#define RES_INVALID_CLA_SW2 0x00 // Invalid class

#define RES_MEMORY_FAILURE_SW1 0x65 // Memory failure
#define RES_MEMORY_FAILURE_SW2 0x81 // Memory failure

#define RES_NOT_ENOUGH_MEMORY_SW1 0x6A // Not enough memory space
#define RES_NOT_ENOUGH_MEMORY_SW2 0x84 // Not enough memory space

#define RES_SSP_NOT_AVAILABLE_SW1 0x6A // SSP is not available
#define RES_SSP_NOT_AVAILABLE_SW2 0x81 // SSP is not available

#define RES_REF_DATA_NOT_FOUND_SW1 0x6A // Referenced data not found
#define RES_REF_DATA_NOT_FOUND_SW2 0x88 // Referenced data not found

#define RES_SSP_UNDER_PROCESS_SW1 0x69 // Condition of use not satisfied
#define RES_SSP_UNDER_PROCESS_SW2 0x85 // Condition of use not satisfied

#define RES_AID_NOT_EXIST_SW1 0x6A // AID does not exist
#define RES_AID_NOT_EXIST_SW2 0x82 // AID does not exist


#endif /* HEADER_APDU_TEST_H */

