// @generated — do not edit
import { createDomainError } from "@tailor-platform/erp-kit/core";

export const ChannelNotFoundError = createDomainError(
  "ChannelNotFoundError", "NOTIFICATION_CHANNEL_NOT_FOUND",
  (identifier: string) => `No NotificationChannel row matches the supplied channelId: ${identifier}`,
);

export const NotificationNotFoundError = createDomainError(
  "NotificationNotFoundError", "NOTIFICATION_NOTIFICATION_NOT_FOUND",
  (identifier: string) => `No Notification matches the supplied notificationId: ${identifier}`,
);

export const NotDeliveredError = createDomainError(
  "NotDeliveredError", "NOTIFICATION_NOT_DELIVERED",
  (identifier: string) => `Notification's deliveryStatus is one of QUEUED, FAILED, BOUNCED and is not user-actionable: ${identifier}`,
);

export const ForbiddenError = createDomainError(
  "ForbiddenError", "NOTIFICATION_FORBIDDEN",
  (identifier: string) => `Caller is not authorized to perform this operation in the target scope: ${identifier}`,
);

export const CategoryNotOptOutAbleError = createDomainError(
  "CategoryNotOptOutAbleError", "NOTIFICATION_CATEGORY_NOT_OPT_OUT_ABLE",
  (identifier: string) => `Target NotificationCategory has optOutAllowed = false and the requested change would persist an opt-out directive: ${identifier}`,
);

export const CategoryNotFoundError = createDomainError(
  "CategoryNotFoundError", "NOTIFICATION_CATEGORY_NOT_FOUND",
  (identifier: string) => `No NotificationCategory matches the supplied categoryId: ${identifier}`,
);

export const MissingRequiredFieldError = createDomainError(
  "MissingRequiredFieldError", "NOTIFICATION_MISSING_REQUIRED_FIELD",
  (identifier: string) => `One or more required input fields are missing or blank: ${identifier}`,
);

export const InvalidStateError = createDomainError(
  "InvalidStateError", "NOTIFICATION_INVALID_STATE",
  (identifier: string) => `the state token is missing, expired, or tampered: ${identifier}`,
);

export const OauthExchangeFailedError = createDomainError(
  "OauthExchangeFailedError", "NOTIFICATION_OAUTH_EXCHANGE_FAILED",
  (identifier: string) => `the code is blank, the exchange call threw, or the result is not ok / lacks an access token or team id: ${identifier}`,
);

export const TeamAlreadyConnectedError = createDomainError(
  "TeamAlreadyConnectedError", "NOTIFICATION_TEAM_ALREADY_CONNECTED",
  (identifier: string) => `an existing ACTIVE connection is bound to a different teamId: ${identifier}`,
);

export const DuplicateChannelIdError = createDomainError(
  "DuplicateChannelIdError", "NOTIFICATION_DUPLICATE_CHANNEL_ID",
  (identifier: string) => `A NotificationChannel row already exists for the supplied channelId: ${identifier}`,
);

export const DuplicateTemplateKeyError = createDomainError(
  "DuplicateTemplateKeyError", "NOTIFICATION_DUPLICATE_TEMPLATE_KEY",
  (identifier: string) => `A NotificationTemplate row already exists for the supplied (eventType, channelId, locale) triple: ${identifier}`,
);

export const EventTypeNotFoundError = createDomainError(
  "EventTypeNotFoundError", "NOTIFICATION_EVENT_TYPE_NOT_FOUND",
  (identifier: string) => `eventType is absent from the dispatcher's Event Catalog: ${identifier}`,
);

export const UndeclaredVariableReferenceError = createDomainError(
  "UndeclaredVariableReferenceError", "NOTIFICATION_UNDECLARED_VARIABLE_REFERENCE",
  (identifier: string) => `subject / body / htmlBody contains a {{variable}} reference that is not declared in variableSchema: ${identifier}`,
);

export const TemplateNotFoundError = createDomainError(
  "TemplateNotFoundError", "NOTIFICATION_TEMPLATE_NOT_FOUND",
  (identifier: string) => `No NotificationTemplate row matches the supplied identifier: ${identifier}`,
);

export const InvalidEventError = createDomainError(
  "InvalidEventError", "NOTIFICATION_INVALID_EVENT",
  (identifier: string) => `the event payload is missing a teamId: ${identifier}`,
);

export const SignatureInvalidError = createDomainError(
  "SignatureInvalidError", "NOTIFICATION_SIGNATURE_INVALID",
  (identifier: string) => `the Slack request signature is missing, stale, or fails HMAC verification: ${identifier}`,
);

export const MissingEntityReferenceError = createDomainError(
  "MissingEntityReferenceError", "NOTIFICATION_MISSING_ENTITY_REFERENCE",
  (identifier: string) => `sourceType or sourceId is missing: ${identifier}`,
);

export const InvalidPayloadError = createDomainError(
  "InvalidPayloadError", "NOTIFICATION_INVALID_PAYLOAD",
  (identifier: string) => `payload cannot be normalized to JSON: ${identifier}`,
);

export const InvalidEventTypeError = createDomainError(
  "InvalidEventTypeError", "NOTIFICATION_INVALID_EVENT_TYPE",
  (identifier: string) => `eventType is not one of DELIVERED, BOUNCED, or OPENED: ${identifier}`,
);

export const InvalidRetentionTtlError = createDomainError(
  "InvalidRetentionTtlError", "NOTIFICATION_INVALID_RETENTION_TTL",
  (identifier: string) => `ttlDays is not a positive integer (zero, negative, fractional, or NaN): ${identifier}`,
);

export const NoMatchError = createDomainError(
  "NoMatchError", "NOTIFICATION_NO_MATCH",
  (identifier: string) => `No matching row exists for the supplied input; null or empty result is returned: ${identifier}`,
);

export const TemplateVarValidationFailedError = createDomainError(
  "TemplateVarValidationFailedError", "NOTIFICATION_TEMPLATE_VAR_VALIDATION_FAILED",
  (identifier: string) => `payloadVars is missing a required declared variable or contains a wrong-type value: ${identifier}`,
);
