// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "../../contracts/dbis/DBIS_SignerRegistry.sol";

/// @notice Pilot quorum: single compliance signer for MintAuth E2E on Chain 138.
contract WireDBISRailSigners is Script {
    function run() external {
        uint256 pk = vm.envUint("PRIVATE_KEY");
        address admin = vm.envOr("ADMIN_ADDRESS", vm.addr(pk));
        address signerRegAddr = vm.envAddress("DBIS_SIGNER_REGISTRY");
        DBIS_SignerRegistry signerReg = DBIS_SignerRegistry(signerRegAddr);

        vm.startBroadcast(pk);

        if (signerReg.getSignerCount() == 0) {
            signerReg.addSigner(admin, signerReg.CATEGORY_COMPLIANCE());
        }

        signerReg.setQuorum(1, 1 << signerReg.CATEGORY_COMPLIANCE(), signerReg.categoryMaskAllowed());

        vm.stopBroadcast();
    }
}
