use thiserror::Error; /// Represents errors that can occur during RSVP acceptance operations. /// /// These errors typically occur during the acceptance workflow, including /// ticket creation, validation, and acceptance record management. #[derive(Debug, Error)] pub(crate) enum AcceptanceError { /// Error when retrieving an acceptance ticket fails. /// /// This error occurs when a database query for an acceptance ticket /// fails due to connectivity or query issues. #[error("error-smokesignal-acceptance-1 Failed to get acceptance ticket: {0}")] TicketGetFailed(String), /// Error when an acceptance ticket is not found. /// /// This error occurs when attempting to retrieve an acceptance ticket /// that doesn't exist in the database. #[error("error-smokesignal-acceptance-2 Acceptance ticket not found")] TicketNotFound, /// Error when retrieving the latest acceptance ticket fails. /// /// This error occurs when querying for the most recent acceptance ticket /// fails due to database issues. #[error("error-smokesignal-acceptance-3 Failed to get latest acceptance ticket: {0}")] LatestTicketGetFailed(String), /// Error when retrieving an RSVP for validation fails. /// /// This error occurs when querying for an RSVP record during the /// acceptance validation process fails. #[error("error-smokesignal-acceptance-4 Failed to get RSVP for validation: {0}")] RsvpGetFailed(String), /// Error when an RSVP is not found. /// /// This error occurs when attempting to retrieve an RSVP record /// that doesn't exist in the database. #[error("error-smokesignal-acceptance-5 RSVP not found")] RsvpNotFound, /// Error when an acceptance AT-URI is invalid. /// /// This error occurs when attempting to parse an AT-URI for an /// acceptance record that is malformed or invalid. #[error("error-smokesignal-acceptance-6 Invalid acceptance AT-URI: {0}")] InvalidAcceptanceAtUri(String), /// Error when resolving the organizer's DID fails. /// /// This error occurs when DID resolution for the event organizer /// fails during the acceptance workflow. #[error("error-smokesignal-acceptance-7 Failed to resolve organizer DID: {0}")] OrganizerDidResolveFailed(String), /// Error when the organizer has no PDS endpoint. /// /// This error occurs when the organizer's DID document doesn't contain /// any PDS endpoints, preventing acceptance record creation. #[error("error-smokesignal-acceptance-8 Organizer has no PDS endpoint")] OrganizerNoPdsEndpoint, /// Error when retrieving an acceptance record from AT Protocol fails. /// /// This error occurs when fetching an acceptance record from the /// organizer's PDS fails. #[error("error-smokesignal-acceptance-9 Failed to get acceptance record: {0}")] AcceptanceRecordGetFailed(String), /// Error when deserializing an RSVP record fails. /// /// This error occurs when attempting to parse RSVP record JSON data /// that is malformed or invalid. #[error("error-smokesignal-acceptance-10 Failed to deserialize RSVP record: {0}")] RsvpDeserializeFailed(String), /// Error when appending a remote attestation fails. /// /// This error occurs when adding an attestation to an RSVP record /// fails during the acceptance workflow. #[error("error-smokesignal-acceptance-12 Failed to append remote attestation: {0}")] AttestationAppendFailed(String), /// Error when an RSVP AT-URI is invalid. /// /// This error occurs when attempting to parse an AT-URI for an RSVP /// record that is malformed or invalid. #[error("error-smokesignal-acceptance-13 Invalid RSVP AT-URI: {0}")] InvalidRsvpAtUri(String), /// Error when updating an RSVP via AT Protocol fails. /// /// This error occurs when the AT Protocol putRecord operation fails /// when updating an RSVP with acceptance information. #[error("error-smokesignal-acceptance-14 AT Protocol error updating RSVP: {0}")] RsvpUpdateAtProtocolFailed(String), /// Error when updating an RSVP fails. /// /// This error occurs when a generic error happens during RSVP update /// that isn't specifically an AT Protocol error. #[error("error-smokesignal-acceptance-15 Failed to update RSVP: {0}")] RsvpUpdateFailed(String), /// Error when updating the RSVP validated_at timestamp fails. /// /// This error occurs when updating the database to mark an RSVP as /// validated fails. #[error("error-smokesignal-acceptance-16 Failed to update RSVP validated_at: {0}")] RsvpValidatedAtUpdateFailed(String), /// Error when deleting an acceptance ticket fails. /// /// This error occurs when removing a processed acceptance ticket /// from the database fails. #[error("error-smokesignal-acceptance-17 Failed to delete acceptance ticket: {0}")] TicketDeleteFailed(String), /// Error when serializing acceptance data fails. /// /// This error occurs when converting acceptance data to JSON format /// fails during record creation. #[error("error-smokesignal-acceptance-19 Failed to serialize acceptance: {0}")] AcceptanceSerializeFailed(String), /// Error when creating a remote attestation proof fails. /// /// This error occurs when generating a cryptographic proof for /// remote attestation fails. #[error("error-smokesignal-acceptance-20 Failed to create remote attestation proof: {0}")] AttestationProofCreateFailed(String), /// Error when the AT Protocol putRecord operation returns an error. /// /// This error occurs when creating an acceptance record via AT Protocol /// fails with an error response from the PDS. #[error("error-smokesignal-acceptance-21 AT Protocol putRecord failed: {0}")] PutRecordFailed(String), /// Error when storing an acceptance ticket fails. /// /// This error occurs when saving a new acceptance ticket to the /// database fails. #[error("error-smokesignal-acceptance-22 Failed to store acceptance ticket: {0}")] TicketStoreFailed(String), /// Error when deleting an acceptance record fails. /// /// This error occurs when removing an acceptance record from the /// database fails during unacceptance operations. #[error("error-smokesignal-acceptance-23 Failed to delete acceptance record: {0}")] AcceptanceRecordDeleteFailed(String), /// Error when clearing the RSVP validated_at timestamp fails. /// /// This error occurs when resetting the validated_at field during /// unacceptance operations fails. #[error("error-smokesignal-acceptance-24 Failed to clear RSVP validated_at: {0}")] RsvpValidatedAtClearFailed(String), /// Error when the AT Protocol deleteRecord operation fails. /// /// This error occurs when deleting an acceptance record via AT Protocol /// fails with an error response from the PDS. #[error("error-smokesignal-acceptance-25 AT Protocol deleteRecord failed: {0}")] DeleteRecordFailed(String), /// Error when user is not authorized to perform the operation. /// /// This error occurs when a user attempts to perform an acceptance /// operation they don't have permission for. #[error("error-smokesignal-acceptance-26 Not authorized")] NotAuthorized, /// Error when retrieving the event fails. /// /// This error occurs when querying for the event record during /// external attestation processing fails. #[error("error-smokesignal-acceptance-27 Failed to get event: {0}")] EventGetFailed(String), /// Error when inserting a new RSVP fails. /// /// This error occurs when creating a new RSVP record during /// external attestation processing fails. #[error("error-smokesignal-acceptance-28 Failed to insert RSVP: {0}")] RsvpInsertFailed(String), }