/**
 * @see {@link https://discord.com/developers/docs/topics/opcodes-and-status-codes#json-json-error-codes}
 */
export enum RESTJSONErrorCodes {
	GeneralError,

	UnknownAccount = 10_001,
	UnknownApplication,
	UnknownChannel,
	UnknownGuild,
	UnknownIntegration,
	UnknownInvite,
	UnknownMember,
	UnknownMessage,
	UnknownPermissionOverwrite,
	UnknownProvider,
	UnknownRole,
	UnknownToken,
	UnknownUser,
	UnknownEmoji,
	UnknownWebhook,
	UnknownWebhookService,

	UnknownSession = 10_020,
	UnknownAsset,

	UnknownBan = 10_026,
	UnknownSKU,
	UnknownStoreListing,
	UnknownEntitlement,
	UnknownBuild,
	UnknownLobby,
	UnknownBranch,
	UnknownStoreDirectoryLayout,

	UnknownRedistributable = 10_036,

	UnknownGiftCode = 10_038,

	UnknownStream = 10_049,
	UnknownPremiumServerSubscribeCooldown,

	UnknownGuildTemplate = 10_057,

	UnknownDiscoverableServerCategory = 10_059,
	UnknownSticker,
	UnknownStickerPack,
	UnknownInteraction,
	UnknownApplicationCommand,

	UnknownVoiceState = 10_065,
	UnknownApplicationCommandPermissions,
	UnknownStageInstance,
	UnknownGuildMemberVerificationForm,
	UnknownGuildWelcomeScreen,
	UnknownGuildScheduledEvent,
	UnknownGuildScheduledEventUser,

	UnknownTag = 10_087,

	UnknownSound = 10_097,

	BotsCannotUseThisEndpoint = 20_001,
	OnlyBotsCanUseThisEndpoint,

	ExplicitContentCannotBeSentToTheDesiredRecipient = 20_009,

	NotAuthorizedToPerformThisActionOnThisApplication = 20_012,

	ActionCannotBePerformedDueToSlowmodeRateLimit = 20_016,
	TheMazeIsntMeantForYou,
	OnlyTheOwnerOfThisAccountCanPerformThisAction,

	AnnouncementEditLimitExceeded = 20_022,

	UnderMinimumAge = 20_024,

	ChannelWriteRateLimit = 20_028,
	/**
	 * @deprecated Use {@link RESTJSONErrorCodes.ChannelWriteRateLimit} instead
	 */
	ChannelSendRateLimit = ChannelWriteRateLimit,
	ServerWriteRateLimit = 20_029,
	/**
	 * @deprecated Use {@link RESTJSONErrorCodes.ServerWriteRateLimit} instead
	 */
	ServerSendRateLimit = ServerWriteRateLimit,

	StageTopicServerNameServerDescriptionOrChannelNamesContainDisallowedWords = 20_031,

	GuildPremiumSubscriptionLevelTooLow = 20_035,

	MaximumNumberOfGuildsReached = 30_001,
	MaximumNumberOfFriendsReached,
	MaximumNumberOfPinsReachedForTheChannel,
	MaximumNumberOfRecipientsReached,
	MaximumNumberOfGuildRolesReached,

	MaximumNumberOfWebhooksReached = 30_007,
	MaximumNumberOfEmojisReached,

	MaximumNumberOfReactionsReached = 30_010,
	MaximumNumberOfGroupDMsReached,

	MaximumNumberOfGuildChannelsReached = 30_013,

	MaximumNumberOfAttachmentsInAMessageReached = 30_015,
	MaximumNumberOfInvitesReached,

	MaximumNumberOfAnimatedEmojisReached = 30_018,
	MaximumNumberOfServerMembersReached,

	MaximumNumberOfServerCategoriesReached = 30_030,

	GuildAlreadyHasTemplate = 30_031,
	MaximumNumberOfApplicationCommandsReached,
	MaximumThreadParticipantsReached,
	MaximumDailyApplicationCommandCreatesReached,
	MaximumNumberOfNonGuildMemberBansHasBeenExceeded,

	MaximumNumberOfBanFetchesHasBeenReached = 30_037,
	MaximumNumberOfUncompletedGuildScheduledEventsReached,

	MaximumNumberOfStickersReached = 30_039,
	MaximumNumberOfPruneRequestsHasBeenReached,

	MaximumNumberOfGuildWidgetSettingsUpdatesHasBeenReached = 30_042,

	MaximumNumberOfSoundboardSoundsReached = 30_045,
	MaximumNumberOfEditsToMessagesOlderThanOneHourReached,
	MaximumNumberOfPinnedThreadsInForumHasBeenReached,
	MaximumNumberOfTagsInForumHasBeenReached,

	BitrateIsTooHighForChannelOfThisType = 30_052,

	MaximumNumberOfPremiumEmojisReached = 30_056,

	MaximumNumberOfWebhooksPerGuildReached = 30_058,

	MaximumNumberOfChannelPermissionOverwritesReached = 30_060,
	TheChannelsForThisGuildAreTooLarge,

	Unauthorized = 40_001,
	VerifyYourAccount,
	OpeningDirectMessagesTooFast,
	SendMessagesHasBeenTemporarilyDisabled,
	RequestEntityTooLarge,
	FeatureTemporarilyDisabledServerSide,
	UserBannedFromThisGuild,

	ConnectionHasBeenRevoked = 40_012,

	OnlyConsumableSKUsCanBeConsumed = 40_018,
	YouCanOnlyDeleteSandboxEntitlements,

	TargetUserIsNotConnectedToVoice = 40_032,
	ThisMessageWasAlreadyCrossposted,

	ApplicationCommandWithThatNameAlreadyExists = 40_041,

	ApplicationInteractionFailedToSend = 40_043,

	CannotSendAMessageInAForumChannel = 40_058,

	InteractionHasAlreadyBeenAcknowledged = 40_060,
	TagNamesMustBeUnique,
	ServiceResourceIsBeingRateLimited,

	ThereAreNoTagsAvailableThatCanBeSetByNonModerators = 40_066,
	TagRequiredToCreateAForumPostInThisChannel,

	AnEntitlementHasAlreadyBeenGrantedForThisResource = 40_074,

	ThisInteractionHasHitTheMaximumNumberOfFollowUpMessages = 40_094,

	CloudflareIsBlockingYourRequest = 40_333,

	MissingAccess = 50_001,
	InvalidAccountType,
	CannotExecuteActionOnDMChannel,
	GuildWidgetDisabled,
	CannotEditMessageAuthoredByAnotherUser,
	CannotSendAnEmptyMessage,
	/**
	 * @see {@link RESTJSONErrorCodes.CannotSendMessagesToThisUserDueToHavingNoMutualGuilds} for a similar error code
	 */
	CannotSendMessagesToThisUser,
	CannotSendMessagesInNonTextChannel,
	ChannelVerificationLevelTooHighForYouToGainAccess,
	OAuth2ApplicationDoesNotHaveBot,
	OAuth2ApplicationLimitReached,
	InvalidOAuth2State,
	MissingPermissions,
	InvalidToken,
	NoteWasTooLong,
	ProvidedTooFewOrTooManyMessagesToDelete,
	InvalidMFALevel,

	MessageCanOnlyBePinnedInTheChannelItWasSentIn = 50_019,
	InviteCodeInvalidOrTaken,
	CannotExecuteActionOnSystemMessage,

	CannotExecuteActionOnThisChannelType = 50_024,
	InvalidOAuth2AccessToken,
	MissingRequiredOAuth2Scope,

	InvalidWebhookToken = 50_027,
	InvalidRole,

	InvalidRecipients = 50_033,
	OneOfTheMessagesProvidedWasTooOldForBulkDelete,
	InvalidFormBodyOrContentType,
	InviteAcceptedToGuildWithoutTheBotBeingIn,

	InvalidActivityAction = 50_039,

	InvalidAPIVersion = 50_041,

	FileUploadedExceedsMaximumSize = 50_045,
	InvalidFileUploaded,

	CannotSelfRedeemThisGift = 50_054,
	InvalidGuild,

	InvalidSKU = 50_057,

	InvalidRequestOrigin = 50_067,
	InvalidMessageType,

	PaymentSourceRequiredToRedeemGift = 50_070,

	CannotModifyASystemWebhook = 50_073,
	CannotDeleteChannelRequiredForCommunityGuilds,

	CannotEditStickersWithinMessage = 50_080,
	InvalidStickerSent,

	InvalidActionOnArchivedThread = 50_083,
	InvalidThreadNotificationSettings,
	ParameterEarlierThanCreation,
	CommunityServerChannelsMustBeTextChannels,

	TheEntityTypeOfTheEventIsDifferentFromTheEntityYouAreTryingToStartTheEventFor = 50_091,

	ServerNotAvailableInYourLocation = 50_095,

	ServerNeedsMonetizationEnabledToPerformThisAction = 50_097,

	ServerNeedsMoreBoostsToPerformThisAction = 50_101,

	RequestBodyContainsInvalidJSON = 50_109,
	ProvidedFileIsInvalid,

	ProvidedFileTypeIsInvalid = 50_123,
	ProvidedFileDurationExceedsMaximumLength,

	OwnerCannotBePendingMember = 50_131,
	OwnershipCannotBeMovedToABotUser,

	FailedToResizeAssetBelowTheMaximumSize = 50_138,
	/**
	 * @deprecated This name is incorrect. Use {@link RESTJSONErrorCodes.FailedToResizeAssetBelowTheMaximumSize} instead
	 */
	FailedToResizeAssetBelowTheMinimumSize = FailedToResizeAssetBelowTheMaximumSize,

	CannotMixSubscriptionAndNonSubscriptionRolesForAnEmoji = 50_144,
	CannotConvertBetweenPremiumEmojiAndNormalEmoji,
	UploadedFileNotFound,

	SpecifiedEmojiIsInvalid = 50_151,

	VoiceMessagesDoNotSupportAdditionalContent = 50_159,
	VoiceMessagesMustHaveASingleAudioAttachment,
	VoiceMessagesMustHaveSupportingMetadata,
	VoiceMessagesCannotBeEdited,
	CannotDeleteGuildSubscriptionIntegration,

	YouCannotSendVoiceMessagesInThisChannel = 50_173,

	TheUserAccountMustFirstBeVerified = 50_178,

	ProvidedFileDoesNotHaveAValidDuration = 50_192,

	/**
	 * @see {@link RESTJSONErrorCodes.CannotSendMessagesToThisUser} for a similar error code
	 */
	CannotSendMessagesToThisUserDueToHavingNoMutualGuilds = 50_278,

	YouDoNotHavePermissionToSendThisSticker = 50_600,

	TwoFactorAuthenticationIsRequired = 60_003,

	NoUsersWithDiscordTagExist = 80_004,

	ReactionWasBlocked = 90_001,
	UserCannotUseBurstReactions,

	IndexNotYetAvailable = 110_000,
	ApplicationNotYetAvailable,

	APIResourceOverloaded = 130_000,

	TheStageIsAlreadyOpen = 150_006,

	CannotReplyWithoutPermissionToReadMessageHistory = 160_002,

	ThreadAlreadyCreatedForMessage = 160_004,
	ThreadLocked,
	MaximumActiveThreads,
	MaximumActiveAnnouncementThreads,

	CannotForwardMessageWithUnreadableContent = 160_014,

	InvalidJSONForUploadedLottieFile = 170_001,
	UploadedLottiesCannotContainRasterizedImages,
	StickerMaximumFramerateExceeded,
	StickerFrameCountExceedsMaximumOf1000Frames,
	LottieAnimationMaximumDimensionsExceeded,
	StickerFramerateIsTooSmallOrTooLarge,
	StickerAnimationDurationExceedsMaximumOf5Seconds,

	CannotUpdateAFinishedEvent = 180_000,

	FailedToCreateStageNeededForStageEvent = 180_002,

	MessageWasBlockedByAutomaticModeration = 200_000,
	TitleWasBlockedByAutomaticModeration,

	WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadId = 220_001,
	WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadId,
	WebhooksCanOnlyCreateThreadsInForumChannels,
	WebhookServicesCannotBeUsedInForumChannels,

	MessageBlockedByHarmfulLinksFilter = 240_000,

	CannotEnableOnboardingRequirementsAreNotMet = 350_000,
	CannotUpdateOnboardingWhileBelowRequirements,

	AccessToFileUploadsHasBeenLimitedForThisGuild = 400_001,

	FailedToBanUsers = 500_000,

	PollVotingBlocked = 520_000,
	PollExpired,
	InvalidChannelTypeForPollCreation,
	CannotEditAPollMessage,
	CannotUseAnEmojiIncludedWithThePoll,

	CannotExpireANonPollMessage = 520_006,

	ProvisionalAccountsPermissionNotGranted = 530_000,
	IdTokenJWTExpired,
	IdTokenJWTIssuerMismatch,
	IdTokenJWTAudienceMismatch,
	IdTokenJWTIssuedTooLongAgo,

	FailedToGenerateUniqueUsername = 530_006,
	InvalidClientSecret,
}

/**
 * JSON Error Codes that represent "Cannot send messages to this user".
 * Discord uses two different error codes for this error:
 * - {@link RESTJSONErrorCodes.CannotSendMessagesToThisUser} (50_007)
 * - {@link RESTJSONErrorCodes.CannotSendMessagesToThisUserDueToHavingNoMutualGuilds} (50_278)
 */
export const CannotSendMessagesToThisUserErrorCodes = [
	RESTJSONErrorCodes.CannotSendMessagesToThisUser,
	RESTJSONErrorCodes.CannotSendMessagesToThisUserDueToHavingNoMutualGuilds,
] as const;

/**
 * @see {@link https://discord.com/developers/docs/reference#locales}
 */
export enum Locale {
	Indonesian = 'id',
	EnglishUS = 'en-US',
	EnglishGB = 'en-GB',
	Bulgarian = 'bg',
	ChineseCN = 'zh-CN',
	ChineseTW = 'zh-TW',
	Croatian = 'hr',
	Czech = 'cs',
	Danish = 'da',
	Dutch = 'nl',
	Finnish = 'fi',
	French = 'fr',
	German = 'de',
	Greek = 'el',
	Hindi = 'hi',
	Hungarian = 'hu',
	Italian = 'it',
	Japanese = 'ja',
	Korean = 'ko',
	Lithuanian = 'lt',
	Norwegian = 'no',
	Polish = 'pl',
	PortugueseBR = 'pt-BR',
	Romanian = 'ro',
	Russian = 'ru',
	SpanishES = 'es-ES',
	SpanishLATAM = 'es-419',
	Swedish = 'sv-SE',
	Thai = 'th',
	Turkish = 'tr',
	Ukrainian = 'uk',
	Vietnamese = 'vi',
}

/**
 * @deprecated Use {@link Locale} instead.
 */
export type LocaleString = `${Locale}`;
