contract Coalition_Crew_Special_Edition is
    Ownable,
    ERC1155PresetMinterPauser(
        "https://gateway.pinata.cloud/ipfs/Qmcz89g9m4JSm5aT2mV41F9ZzSDpSx1UvYoWYtN2SgAtcN/1.json"
    )
{
    constructor() {
        _mint(msg.sender, 1, 1, "");
    }

    // id => uri of id
    mapping(uint256 => string) public uriOf;

    // token uri
    function uri(uint256 _tokenId)
        public
        view
        override
        returns (string memory)
    {
        return uriOf[_tokenId];
    }

    function setURI(string calldata newuri) public onlyOwner {
        _setURI(newuri);
    }

    // Send ERC1155 to a list of addresses
    function giftToList(
        address[] calldata _sendNftsTo,
        uint256[] calldata _ids,
        uint256[] calldata _amounts
    ) external onlyOwner {
        require(
            _sendNftsTo.length == _ids.length && _ids.length == _amounts.length,
            "incorrect data"
        );

        for (uint256 i = 0; i < _ids.length; i++)
            _mint(_sendNftsTo[i], _ids[i], _amounts[i], "");
    }

    // Send ERC1155 to a list of addresses
    function giftToList(
        address[] calldata _sendNftsTo,
        uint256 _id,
        uint256 _amount
    ) external onlyOwner {
        for (uint256 i = 0; i < _sendNftsTo.length; i++)
            _mint(_sendNftsTo[i], _id, _amount, "");
    }

    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal override(ERC1155PresetMinterPauser) {
        for (uint256 i = 0; i < ids.length; i++) uriOf[ids[i]] = super.uri(0);

        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
    }
}
function giftToList(
    address[] calldata _sendNftsTo,
    uint256 _id,
    uint256 _amount
) external onlyOwner {
    for (uint256 i = 0; i < _sendNftsTo.length; i++)
        _mint(_sendNftsTo[i], _id, _amount, "");
}

// Send ERC1155 to a list of addresses