How classes for devices and sensors are implemented in Samsung SmartThings applications?

Hello everyone,

We want to implement an infrastructure for Samsung Groovy SmartThings. The major part for the infrastructure of course is to implement different classes for each device with their corresponding methods. For example for locks’ devices, we assumed that we have a lock class with methods lock() and unlock(). The problem here is that we have this part of code in one of the SmartThings applications which are in Groovy:

def presence(evt)
if (evt.value == “present”) {
else {

So most probably, lock1 is the object for class lock, and lock() and unlock() are methods for that class. Here is the thing: Using lock1[0].unlock() command unlocks the door lock number #0, but using lock1.unlock() command unlocks all the door locks.

The question here is that how the class is created? If lock1 is a list of objects, how we can have a command like lock1.unlock().

The point here is that both of the objects should have the same name lock1, and both of the methods are the same method named lock().

Thank you in advance.