'use strict';

const Token = require('./Token-8c5ba5d9.js');
require('./index-c910887e.js');
const Item = require('./Item-00ce8c24.js');
const index = require('./index-0b2930ca.js');
require('./ok-97a5fd0b.js');
require('./index-9d95c045.js');
require('./index-cc85865d.js');
require('./TextDecoder-753156f3.js');
require('./_commonjsHelpers-537d719a.js');
require('./index-09251373.js');

class Settlement {
    constructor(connection) {
        this.connection = connection;
    }
    async list(date, days) {
        return await this.connection.get("settlement" +
            (date && days ? `?date=${date}&days=${days}` : date ? `?date=${date}` : days ? `?days=${days}` : ""));
    }
    async report(settlements, language) {
        return this.connection.post(`settlement/report?language=${language}`, settlements);
    }
    async load(id) {
        return Token.Identifier.is(id)
            ? await this.connection.get("settlement/" + id)
            : (await Promise.all(id.map(i => this.connection.get("settlement/" + i)))).filter(index.Settlement.is);
    }
    static open(url, token) {
        const connection = Item.Connection.open(url, token);
        return connection && new Settlement(connection);
    }
}

exports.Settlement = Settlement;
