public with sharing class LexCancelConsumDetailsCtl {
    public LexCancelConsumDetailsCtl() {

    }

    @AuraEnabled
    public static List<Consum_Apply_Equipment_Set__c> splitApplyButton(String recordId){

        try{
            List<Consum_Apply_Equipment_Set__c> report=[select RAES_Status__c from Consum_Apply_Equipment_Set__c where Consum_Apply__c =: recordId];
            if(report.size() > 0){
                return report;
            }
            return null;
        }catch(Exception e){
            System.debug(LoggingLevel.INFO,'Consum_Apply_Equipment_Set__c Cancel Error : ' + e);
        }
        return null;
    }

    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new initData();
        try {
            List<Consum_Apply__c> repList = [select Id,Yi_loaner_arranged__c from Consum_Apply__c where Id =: recordId];
            if(repList.size() > 0){
                Consum_Apply__c rep = repList[0];
                res.consumApplyId = rep.Id;
                res.yiLoaner = rep.Yi_loaner_arranged__c;
                List<Consum_Apply_Equipment_Set__c> repSetList = [select Id,Yi_loaner_arranged__c from Consum_Apply_Equipment_Set__c where Consum_Apply__c =: rep.Id];
                if(repSetList.size() > 0){
                    Consum_Apply_Equipment_Set__c repSet = repSetList[0];
                    res.equipmentyiLoaner = repSet.Yi_loaner_arranged__c;
                }else{
                    res.equipmentyiLoaner = -1;
                }
                return res;
            }
            return null;          
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
    }
    public class InitData{
        @AuraEnabled
        public String consumApplyId;
        @AuraEnabled
        public Decimal yiLoaner;
        @AuraEnabled
        public Decimal equipmentyiLoaner;
    }



}