class AgentsModel extends WindozModel {

    constructor() {
        super()
        this.ressource = '/agents'
    }

    async getTypes(family) {
        let endpoint = {...app.config.api[this.ressource].getTypes}
        endpoint.uri = endpoint.uri.replace('{family}', family)
        return ( 
            this.request(endpoint.uri, endpoint.method)
            .then( async serverData => serverData.payload.agentTypes)
        )
    }

    async getSprites(group) {
        let endpoint = {...app.config.api[this.ressource].getSprites}
        endpoint.uri = endpoint.uri.replace('{group}', group)
        return ( 
            this.request(endpoint.uri, endpoint.method)
            .then( async serverData => serverData.payload.agentSprites)
        )
    }

    async getProperties(id) { 
        let endpoint = {...app.config.api[this.ressource].getProperties}
        endpoint.uri = endpoint.uri.replace('{id}', id)
        return ( 
            this.request(endpoint.uri, endpoint.method)
            .then( async serverData => serverData.payload.agentProperties)
        )
    }    
}

app.registerClass('AgentsModel', AgentsModel);