import { I as Identifier, M as Merchant$1, C as Connection } from './index.js';

class Merchant {
    constructor(connection) {
        this.connection = connection;
    }
    async create(request) {
        return await this.connection.post("merchant", request);
    }
    async list() {
        return this.connection.get("merchant");
    }
    async change(request, id) {
        return await this.connection.patch("merchant/" + (Identifier.is(id) ? id : ""), request);
    }
    async load(id) {
        return !id
            ? await this.connection.get("merchant")
            : Identifier.is(id)
                ? await this.connection.get("merchant/" + id)
                : (await Promise.all(id.map(i => this.connection.get("merchant/" + i)))).filter(Merchant$1.is);
    }
    static open(url, token) {
        const connection = Connection.open(url, token);
        return connection && new Merchant(connection);
    }
}

export { Merchant };
