global with sharing class SelectRentalButtonController {
   
    @AuraEnabled
    public static Equipment_Set_Detail__c  getEquipmentSetId(String recordId){
        Equipment_Set_Detail__c res=new Equipment_Set_Detail__c();
        try{
            res=[select  Equipment_Set__c,Select_rental__c from Equipment_Set_Detail__c where Id=: recordId];
        }
        catch(Exception e){
            System.debug(Logginglevel.info,'*******e'+e);
        }
        return res;

    }







   @AuraEnabled
   public static List<Equipment_Set_Detail__c>  getEquipmentSet(String esid){
   
    try{
         List<Equipment_Set_Detail__c>    res=[select Id,Name,Select_rental__c
          from Equipment_Set_Detail__c
           where Equipment_Set__c = : esid];
         return res;
    }
    catch(Exception e){
        System.debug(Logginglevel.info,'*******e'+e);
    }
   
    return null;
   }


   @AuraEnabled
   public static List<String>  updateEquipment(List<Equipment_Set_Detail__c> sqlResult){
    List<String> res=new List<String>();
    try{
        for(Equipment_Set_Detail__c equipMent :  sqlResult){
            update equipMent;
            res.add('success');
        }  
    }
    
    catch(Exception e){
        System.debug(Logginglevel.info,'*******e'+e);
    }
    return res;


   }


   @AuraEnabled
   public static List<Equipment_Set_Detail__c> findIdArea(List<String> id){
    List<Equipment_Set_Detail__c> res = new  List<Equipment_Set_Detail__c>();
    try{
        
        res=[select Id,Select_rental__c from Equipment_Set_Detail__c where Id IN : id ];
    }
    catch (Exception e) {
        System.debug(Logginglevel.info,'*******e'+e);
    }
    return res;
   }


   @AuraEnabled
    public static String getSessionId(){
        return UserInfo.getSessionId();
    }

    @AuraEnabled
    public static List<String>  getRecords(){
        List<String> res= new List<String>();

        try{
        List<Equipment_Set_Detail__c>    obj = [select Id  from Equipment_Set_Detail__c where Select_rental__c=true];
            for(Equipment_Set_Detail__c equipMent : obj){
                res.add(equipMent.Id);
            }
        }

        catch(Exception e){
              System.debug(Logginglevel.info,'*******e'+e);
        }

        return res;
    }

}