<?php
declare(strict_types = 1);

namespace BewitchingSource\CreamailerAPI;

use BewitchingSource\CreamailerAPI\Resource as R;

class Lists extends R {
    public function __construct($parent) {
        $this->resource = "lists";
        parent::__construct($parent);
    }

    public function post(string $id, array $payload) {
        $plc = in_array("Subscribers", $payload['json']);
        $xs = $plc
            ? ["import", $id]
            : [$id];
        parent::post(implode("/", $xs), $payload);
    }
}
