from . import s

class Channel:
    def get_all(self):
        server = s.defaultServer
        channels = server.getChannels()
        return channels

    def get(self, id):
        server = s.defaultServer
        channel = server.getChannelState(id)
        return channel

    def add(self, name, parent):
        server = s.defaultServer
        channel_id = server.addChannel(name, parent)
        return self.get(channel_id)

    def delete(self, id):
        server = s.defaultServer
        result = server.removeChannel(id)
        return True

