-- ROBLOX TODO: fix PrettyFormat types imports

type CompareKeys = ((a: string, b: string) -> number) | nil

local Types = require(CurrentModule.types)
type DiffOptions = Types.DiffOptions
type DiffOptionsNormalized = Types.DiffOptionsNormalized

local function noColor(s): string
	return s
end

local DIFF_CONTEXT_DEFAULT = 5

local OPTIONS_DEFAULT = {
	aAnnotation = "Expected",
	aColor = chalk.green,
	aIndicator = "-",
	bAnnotation = "Received",
	bColor = chalk.red,
	bIndicator = "+",
	changeColor = chalk.inverse,
	changeLineTrailingSpaceColor = noColor,
	commonColor = chalk.dim,
	commonIndicator = " ",
	commonLineTrailingSpaceColor = noColor,
	-- ROBLOX deviation: using Object.None instead of nil because assigning nil is no different from not assigning value at all
	compareKeys = Object.None,
	contextLines = DIFF_CONTEXT_DEFAULT,
	emptyFirstOrLastLinePlaceholder = "",
	expand = true,
	includeChangeCounts = false,
	omitAnnotationLines = false,
	patchColor = chalk.yellow,
}

local function getCompareKeys(compareKeys: CompareKeys?): CompareKeys
	return if compareKeys and typeof(compareKeys) == "function" then compareKeys else OPTIONS_DEFAULT.compareKeys
end

local function getContextLines(contextLines: number?): number
	if typeof(contextLines) == "number" and Number.isSafeInteger(contextLines) and contextLines >= 0 then
		return contextLines
	end
	return DIFF_CONTEXT_DEFAULT
end
