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

import {CheckpointExtensionBase} from "./CheckpointExtensionBase.sol";
import {CheckpointStorage} from "../storage/CheckpointStorage.sol";

/// @notice Emits rich URI events for IPFS/Arweave batch payloads.
contract AttestationURIExtension is CheckpointExtensionBase {
    event AttestationURI(uint64 indexed batchId, bytes32 contentURI, bytes32 payloadHash);

    function HOOK_BEFORE_SUBMIT() external pure override returns (uint32) {
        return 0;
    }

    function HOOK_AFTER_SUBMIT() external pure override returns (uint32) {
        return 1 << 1;
    }

    function HOOK_ON_CCIP() external pure override returns (uint32) {
        return 0;
    }

    function beforeSubmit(CheckpointStorage.CheckpointHeader calldata, bytes calldata) external pure override {}

    function afterSubmit(CheckpointStorage.CheckpointHeader calldata header, bytes calldata data) external {
        if (header.contentURI == bytes32(0)) return;
        bytes32 payloadHash = keccak256(data);
        emit AttestationURI(header.batchId, header.contentURI, payloadHash);
    }

    function onCCIPReceive(bytes calldata) external pure override {}
}
