//! Mapping from types to canonical string identifiers used in testing.
use types::state::HistoricalSummary;
use types::*;

pub trait TypeName {
    fn name() -> &'static str;
}

#[macro_export]
macro_rules! type_name {
    ($typ:ident) => {
        type_name!($typ, stringify!($typ));
    };
    ($typ:ident, $name:expr) => {
        impl TypeName for $typ {
            fn name() -> &'static str {
                $name
            }
        }
    };
}

#[macro_export]
macro_rules! type_name_generic {
    ($typ:ident) => {
        type_name_generic!($typ, stringify!($typ));
    };
    ($typ:ident, $name:expr) => {
        impl<E: EthSpec> TypeName for $typ<E> {
            fn name() -> &'static str {
                $name
            }
        }
    };
}

type_name!(MinimalEthSpec, "minimal");
type_name!(MainnetEthSpec, "mainnet");
type_name_generic!(AggregateAndProof);
type_name_generic!(AggregateAndProofBase, "AggregateAndProof");
type_name_generic!(AggregateAndProofElectra, "AggregateAndProof");
type_name_generic!(Attestation);
type_name_generic!(AttestationBase, "Attestation");
type_name_generic!(AttestationElectra, "Attestation");
type_name!(AttestationData);
type_name_generic!(AttesterSlashing);
type_name_generic!(AttesterSlashingBase, "AttesterSlashing");
type_name_generic!(AttesterSlashingElectra, "AttesterSlashing");
type_name_generic!(BeaconBlock);
type_name_generic!(BeaconBlockBody);
type_name_generic!(BeaconBlockBodyBase, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyAltair, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyBellatrix, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyCapella, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyDeneb, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyElectra, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyFulu, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyGloas, "BeaconBlockBody");
type_name!(BeaconBlockHeader);
type_name_generic!(BeaconState);
type_name!(BlobIdentifier);
type_name_generic!(DataColumnsByRootIdentifier, "DataColumnsByRootIdentifier");
type_name_generic!(BlobSidecar);
type_name_generic!(DataColumnSidecar);
type_name_generic!(DataColumnSidecarFulu, "DataColumnSidecar");
type_name_generic!(DataColumnSidecarGloas, "DataColumnSidecar");
type_name!(Checkpoint);
type_name!(ConsolidationRequest);
type_name_generic!(ContributionAndProof);
type_name!(Deposit);
type_name!(DepositData);
type_name!(DepositMessage);
type_name!(DepositRequest);
type_name!(Eth1Data);
type_name!(Builder);
type_name!(BuilderPendingPayment);
type_name!(BuilderPendingWithdrawal);
type_name!(WithdrawalRequest);
type_name_generic!(ExecutionPayload);
type_name_generic!(ExecutionPayloadBellatrix, "ExecutionPayload");
type_name_generic!(ExecutionPayloadCapella, "ExecutionPayload");
type_name_generic!(ExecutionPayloadDeneb, "ExecutionPayload");
type_name_generic!(ExecutionPayloadElectra, "ExecutionPayload");
type_name_generic!(ExecutionPayloadFulu, "ExecutionPayload");
type_name_generic!(ExecutionPayloadGloas, "ExecutionPayload");
type_name_generic!(FullPayload, "ExecutionPayload");
type_name_generic!(ExecutionPayloadHeader);
type_name_generic!(ExecutionPayloadHeaderBellatrix, "ExecutionPayloadHeader");
type_name_generic!(ExecutionPayloadHeaderCapella, "ExecutionPayloadHeader");
type_name_generic!(ExecutionPayloadHeaderDeneb, "ExecutionPayloadHeader");
type_name_generic!(ExecutionPayloadHeaderElectra, "ExecutionPayloadHeader");
type_name_generic!(ExecutionPayloadHeaderFulu, "ExecutionPayloadHeader");
type_name_generic!(ExecutionPayloadBid);
type_name_generic!(SignedExecutionPayloadBid);
type_name_generic!(ExecutionRequests);
type_name_generic!(ExecutionPayloadEnvelope);
type_name_generic!(SignedExecutionPayloadEnvelope);
type_name_generic!(BlindedPayload, "ExecutionPayloadHeader");
type_name!(Fork);
type_name!(ForkData);
type_name_generic!(HistoricalBatch);
type_name_generic!(IndexedAttestation);
type_name_generic!(IndexedAttestationBase, "IndexedAttestation");
type_name_generic!(IndexedAttestationElectra, "IndexedAttestation");
type_name_generic!(IndexedPayloadAttestation);
type_name_generic!(LightClientBootstrap);
type_name_generic!(LightClientBootstrapAltair, "LightClientBootstrap");
type_name_generic!(LightClientBootstrapCapella, "LightClientBootstrap");
type_name_generic!(LightClientBootstrapDeneb, "LightClientBootstrap");
type_name_generic!(LightClientBootstrapElectra, "LightClientBootstrap");
type_name_generic!(LightClientBootstrapFulu, "LightClientBootstrap");
type_name_generic!(LightClientFinalityUpdate);
type_name_generic!(LightClientFinalityUpdateAltair, "LightClientFinalityUpdate");
type_name_generic!(
    LightClientFinalityUpdateCapella,
    "LightClientFinalityUpdate"
);
type_name_generic!(LightClientFinalityUpdateDeneb, "LightClientFinalityUpdate");
type_name_generic!(
    LightClientFinalityUpdateElectra,
    "LightClientFinalityUpdate"
);
type_name_generic!(LightClientFinalityUpdateFulu, "LightClientFinalityUpdate");
type_name_generic!(LightClientHeader);
type_name_generic!(LightClientHeaderAltair, "LightClientHeader");
type_name_generic!(LightClientHeaderCapella, "LightClientHeader");
type_name_generic!(LightClientHeaderDeneb, "LightClientHeader");
type_name_generic!(LightClientHeaderElectra, "LightClientHeader");
type_name_generic!(LightClientHeaderFulu, "LightClientHeader");
type_name_generic!(LightClientOptimisticUpdate);
type_name_generic!(
    LightClientOptimisticUpdateAltair,
    "LightClientOptimisticUpdate"
);
type_name_generic!(
    LightClientOptimisticUpdateCapella,
    "LightClientOptimisticUpdate"
);
type_name_generic!(
    LightClientOptimisticUpdateDeneb,
    "LightClientOptimisticUpdate"
);
type_name_generic!(
    LightClientOptimisticUpdateElectra,
    "LightClientOptimisticUpdate"
);
type_name_generic!(
    LightClientOptimisticUpdateFulu,
    "LightClientOptimisticUpdate"
);
type_name_generic!(LightClientUpdate);
type_name_generic!(LightClientUpdateAltair, "LightClientUpdate");
type_name_generic!(LightClientUpdateCapella, "LightClientUpdate");
type_name_generic!(LightClientUpdateDeneb, "LightClientUpdate");
type_name_generic!(LightClientUpdateElectra, "LightClientUpdate");
type_name_generic!(LightClientUpdateFulu, "LightClientUpdate");
type_name_generic!(PendingAttestation);
type_name_generic!(PayloadAttestation);
type_name!(PayloadAttestationData);
type_name!(PayloadAttestationMessage);
type_name!(PendingConsolidation);
type_name!(PendingPartialWithdrawal);
type_name!(PendingDeposit);
type_name!(ProposerSlashing);
type_name!(ProposerPreferences);
type_name!(SignedProposerPreferences);
type_name_generic!(SignedAggregateAndProof);
type_name_generic!(SignedAggregateAndProofBase, "SignedAggregateAndProof");
type_name_generic!(SignedAggregateAndProofElectra, "SignedAggregateAndProof");
type_name_generic!(SignedBeaconBlock);
type_name!(SignedBeaconBlockHeader);
type_name_generic!(SignedContributionAndProof);
type_name!(SignedVoluntaryExit);
type_name!(SigningData);
type_name!(SingleAttestation);
type_name_generic!(SyncCommitteeContribution);
type_name!(SyncCommitteeMessage);
type_name!(SyncAggregatorSelectionData);
type_name_generic!(SyncAggregate);
type_name_generic!(SyncCommittee);
type_name!(Validator);
type_name!(VoluntaryExit);
type_name!(Withdrawal);
type_name!(BlsToExecutionChange, "BLSToExecutionChange");
type_name!(SignedBlsToExecutionChange, "SignedBLSToExecutionChange");
type_name!(HistoricalSummary);
