-- begin TMSEXT_PUBLIC_KEY_SETTING
create table TMSEXT_PUBLIC_KEY_SETTING (
    ID uuid,
    VERSION integer not null,
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    --
    IDX varchar(5) not null,
    RID varchar(10) not null,
    MODULUS text not null,
    EXPONENT varchar(2) not null,
    HASH text not null,
    ALGO varchar(2) not null,
    --
    primary key (ID)
)^
-- end TMSEXT_PUBLIC_KEY_SETTING
-- begin TMSEXT_AID
create table TMSEXT_AID (
    ID uuid,
    VERSION integer not null,
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    NAME varchar(255) not null,
    TXN_TYPE varchar(8) not null,
    AID varchar(32) not null,
    AID_VERSION varchar(4) not null,
    TAC_DEFAULT varchar(10) not null,
    TAC_DENIAL varchar(10) not null,
    TAC_ONLINE varchar(10) not null,
    THRESHOLD varchar(12) not null,
    TARGET_PERCENTAGE varchar(4) not null,
    MAX_TARGET_PERCENTAGE varchar(4) not null,
    DDOL text not null,
    TDOL text not null,
    FLOOR_LIMIT varchar(8) not null,
    APP_SELECT varchar(2) not null,
    AID_PRIORITY varchar(2) not null,
    TRX_TYPE9C varchar(2) not null,
    CATEGORY_CODE varchar(2) not null,
    CL_KERNEL_TO_USE varchar(4),
    CL_OPTIONS varchar(8),
    CL_TRX_LIMIT varchar(12),
    CL_CVM_LIMIT varchar(12),
    CL_FLOOR_LIMIT varchar(12),
    REMARK varchar(100),
    EMV_CONF_TERM_CAPABILITY varchar(100),
    ADDITIONAL_TERM_CAPABILITY varchar(100),
    DATA_TTQ varchar(8),
    --
    primary key (ID)
)^
-- end TMSEXT_AID
-- begin TMSEXT_CARD
create table TMSEXT_CARD (
    ID uuid,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    NAME varchar(100) not null,
    BIN_RANGE_START varchar(10) not null,
    BIN_RANGE_END varchar(10) not null,
    CARD_NUM_LENGTH integer not null,
    PAN_DIGIT_UNMASKING varchar(20) not null,
    PRINT_CARDHOLDER_COPY boolean,
    PRINT_MERCHANT_COPY boolean,
    PRINT_BANK_COPY boolean,
    PIN_LENGTH integer,
    PIN_PROMPT boolean,
    --
    primary key (ID)
)^
-- end TMSEXT_CARD
-- begin TMSEXT_ISSUER
create table TMSEXT_ISSUER (
    ID uuid,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    NAME varchar(30) not null,
    ISSUER_ID varchar(10) not null,
    ON_US boolean,
    ACQUIRER_ID uuid,
    --
    primary key (ID)
)^
-- end TMSEXT_ISSUER
-- begin TMSEXT_TERMINAL_EXT
create table TMSEXT_TERMINAL_EXT (
    ID uuid,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    TERMINAL_ID varchar(8) not null,
    MERCHANT_ID varchar(15) not null,
    MERCHANT_NAME1 varchar(30) not null,
    MERCHANT_NAME2 varchar(30),
    MERCHANT_NAME3 varchar(30),
    MERCHANT_PASSWORD varchar(8),
    ADMIN_PASSWORD varchar(8),
    SETTLEMENT_PASSWORD varchar(8),
    VOID_PASSWORD varchar(8),
    SETTLE_MAX_TRX_COUNT integer,
    SETTLE_WARNING_TRX_COUNT integer,
    CALL_CENTER1 varchar(255),
    CALL_CENTER2 varchar(255),
    BRIZZI_DISCOUNT_PERCENTAGE varchar(10),
    BRIZZI_DISCOUNT_AMOUNT varchar(30),
    FALLBACK_ENABLED boolean,
    QRIS_COUNT_DOWN integer,
    REPRINT_ONLINE_RETRY integer,
    FEATURE_SALE boolean,
    FEATURE_SALE_TIP boolean,
    FEATURE_SALE_REDEMPTION boolean,
    FEATURE_CARD_VERIFICATION boolean,
    FEATURE_SALE_COMPLETION boolean,
    FEATURE_INSTALLMENT boolean,
    FEATURE_SALE_FARE_NON_FARE boolean,
    FEATURE_MANUAL_KEY_IN boolean,
    FEATURE_QRIS boolean,
    INSTALLMENT1_OPTIONS varchar(20),
    INSTALLMENT2_OPTIONS varchar(20),
    INSTALLMENT3_OPTIONS varchar(20),
    FEATURE_CONTACTLESS boolean,
    RANDOM_PIN_KEYPAD boolean,
    BEEP_PIN_KEYPAD boolean,
    AUTO_LOGON boolean,
    NEXT_LOGON integer,
    PUSH_LOGON integer,
    HOST_REPORT boolean,
    HOST_LOGGING boolean,
    SKIP_PASSWORD boolean,
    --
    primary key (ID)
)^
-- end TMSEXT_TERMINAL_EXT
-- begin TMSEXT_ACQUIRER
create table TMSEXT_ACQUIRER (
    ID uuid,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    NAME varchar(30) not null,
    HOST_ID varchar(3),
    SETTLEMENT_HOST_ID varchar(3),
    NUMBER_OF_PRINT integer,
    RESP_TIMEOUT integer,
    ACQUIRER_ID varchar(2),
    HOST_DESTINATION_ADDR varchar(100),
    HOST_DESTINATION_PORT varchar(6),
    SHOW_PRINT_EXP_DATE boolean,
    CHECK_CARD_EXP_DATE boolean,
    TLE_ACQUIRER boolean,
    TLE_SETTING_ID uuid,
    MASTER_KEY_LOCATION varchar(4),
    MASTER_KEY text,
    WORKING_KEY text,
    ACQUIRER_TYPE varchar(50) not null,
    BATCH_NUMBER varchar(6),
    CREDIT_SETTLEMENT boolean,
    DEBIT_SETTLEMENT boolean,
    DESCRIPTION varchar(255),
    --
    primary key (ID)
)^
-- end TMSEXT_ACQUIRER
-- begin TMSEXT_CAPK
create table TMSEXT_CAPK (
    ID uuid,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    NAME varchar(50) not null,
    IDX varchar(255) not null,
    RID varchar(10) not null,
    MODULUS text not null,
    EXPONENT varchar(4) not null,
    ALGO varchar(2) not null,
    HASH text not null,
    EXPIRY_DATE date,
    REMARK varchar(100),
    --
    primary key (ID)
)^
-- end TMSEXT_CAPK
-- begin TMSEXT_TLE_SETTING
create table TMSEXT_TLE_SETTING (
    ID uuid,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    TLE_EFT_SEC varchar(10) not null,
    TLE_ID varchar(2) not null,
    ACQUIRER_ID varchar(3) not null,
    LTMK_AID varchar(3) not null,
    VENDOR_ID varchar(8) not null,
    TLE_VER varchar(1) not null,
    KMS_SECURE_NII varchar(4),
    EDC_SECURE_NII varchar(4),
    CAPK_EXPONENT varchar(2),
    CAPK_LENGTH integer,
    CAPK_VALUE text,
    AID_LENGTH integer,
    AID_VALUE text,
    FIELD_ENCRYPTED1 varchar(3),
    FIELD_ENCRYPTED2 varchar(3),
    FIELD_ENCRYPTED3 varchar(3),
    FIELD_ENCRYPTED4 varchar(3),
    FIELD_ENCRYPTED5 varchar(3),
    FIELD_ENCRYPTED6 varchar(3),
    FIELD_ENCRYPTED7 varchar(3),
    FIELD_ENCRYPTED8 varchar(3),
    FIELD_ENCRYPTED9 varchar(3),
    FIELD_ENCRYPTED10 varchar(3),
    --
    primary key (ID)
)^
-- end TMSEXT_TLE_SETTING
-- begin TMSEXT_ISSUER_CARD_LINK
create table TMSEXT_ISSUER_CARD_LINK (
    ISSUER_ID uuid,
    CARD_ID uuid,
    primary key (ISSUER_ID, CARD_ID)
)^
-- end TMSEXT_ISSUER_CARD_LINK
