import PagedDataProvider from 'bitbucket/internal/impl/data-provider/paged';

import validator from '../json-validation/json-validation';
import models from '../models/models';

/**
 * Provides data about users. Implementers should respect the `filter` property, and should
 * transform their data into a {@link UserModel}.
 */
export default class UserDataProvider extends PagedDataProvider {
    constructor(options, ...args) {
        options.jsonDescriptor = [models.user];
        options.filterDescriptor = {
            term: 'string?',
            permissions: validator.nullable([models.permission]),
        };
        super(options, ...args);
    }
}
