package cz.moneta.test.dsl.util.task.monetaportal.childbuildingsavings;

public class ChildBuildingSavingsSQL {

    public static final String SQL_GET_USERID_AND_SESSION_ID= "SELECT u.userid, u.clientid, u.user_userloginid as userloginid, j.sessionid \n" +
            "FROM UDEBSGE.W_CBL_USERS u \n" +
            "join UDEBSGE.cbl_journal j on j.userid = u.userid \n" +
            "where j.cif = 's%' \n" +
            "and j.apiname like '%deposit-building-savings-child%' \n" +
            "and j.requesttimestamp >= sysdate - 1/100 \n" +
            "order by j.requesttimestamp desc \n" +
            "fetch next 1 rows only";

    public static final String SQL_GET_DU_URL = "select substr(json_value(RESPONSEDATA,'$.responseObject.url'),-6) as CODE from UDEBSGE.cbl_journal " +
            "where apiname like '%/deposit-building-savings-child/id-upload/start%' " +
            "and sessionid = '_SESSIONID_' " +
            "and requesttimestamp >= sysdate - 1";

    public static final String SQL_SELECT_WAITING_FOR_DOCUMENT_REQUEST = "select * from NASDB_OWNER.appl a " +
            "inner join NASDB_OWNER.appl_stat as1 on a.appl_stat_key = as1.appl_stat_key " +
            "inner join NASDB_OWNER.form_tp ft on a.form_tp_key = ft.form_tp_key " +
            "where a.appl_key in ( " +
            "select appl_key from NASDB_OWNER.appl_pt_role where inst_pt_key in(select inst_pt_key from NASDB_OWNER.inst_pt where  " +
            "rc_num = '%s' " +
            ")) " +
            "and a.appl_stat_key = 5 " +
            "and a.ins_dt >= sysdate - 1 " +
            "order by a.UPD_DT DESC";
}
