package core

import "core:strings"

QUALITY_MODIFIER :: "high quality, detailed, clean lines, vibrant colors, professional illustration, best quality, masterpiece"

NEGATIVE_PROMPT_CHARACTER :: "blurry, low quality, distorted face, extra limbs, bad anatomy, deformed, watermark, signature"

NEGATIVE_PROMPT_PANEL :: "blurry, low quality, distorted face, extra limbs, bad anatomy, deformed, watermark, signature, text, speech bubble"

ART_STYLE_KEYWORDS :: [8]string{
	"Japanese manga style, black and white ink, screentone shading, speed lines, dramatic shadows, clean linework, right-to-left reading",
	"American comic book style, bold outlines, vibrant colors, dynamic poses, cross-hatching, Ben-Day dots, left-to-right reading",
	"16-bit pixel art style, retro game aesthetic, limited color palette, crisp pixels, dithering, nostalgic",
	"watercolor painting style, soft edges, paper texture, translucent washes, delicate linework, artistic",
	"film noir style, high contrast black and white, dramatic chiaroscuro lighting, gritty, shadow-heavy, 1940s aesthetic",
	"chibi anime style, super deformed characters, big heads, small bodies, cute, colorful, expressive",
	"pencil sketch style, rough linework, cross-hatching, construction lines, draft aesthetic, monochrome",
	"cyberpunk aesthetic, neon lighting, futuristic cityscapes, holographic elements, high contrast, synthwave colors",
}

get_style_keywords :: proc(key: Art_Style_Key) -> string {
	keywords := ART_STYLE_KEYWORDS
	return keywords[int(key)]
}

parse_art_style_key :: proc(raw: string) -> Art_Style_Key {
	lower := strings.to_lower(raw)
	if strings.contains(lower, "manga") { return .Manga }
	if strings.contains(lower, "western") || strings.contains(lower, "american") || strings.contains(lower, "comic") { return .Western_Comic }
	if strings.contains(lower, "pixel") || strings.contains(lower, "retro") || strings.contains(lower, "8-bit") || strings.contains(lower, "16-bit") { return .Pixel_Art }
	if strings.contains(lower, "watercolor") || strings.contains(lower, "watercolour") { return .Watercolor }
	if strings.contains(lower, "noir") || strings.contains(lower, "film noir") { return .Noir }
	if strings.contains(lower, "chibi") || strings.contains(lower, "super deformed") { return .Chibi }
	if strings.contains(lower, "sketch") || strings.contains(lower, "pencil") || strings.contains(lower, "draw") { return .Sketch }
	if strings.contains(lower, "cyberpunk") || strings.contains(lower, "neon") || strings.contains(lower, "synthwave") { return .Cyberpunk }
	return .Western_Comic
}

Sdxl_Image_Size :: enum {
	Square,
	Landscape_16_9,
	Landscape_4_3,
	Portrait_4_3,
	Square_HD,
	Portrait_16_9,
}

sdxl_size_name :: proc(s: Sdxl_Image_Size) -> string {
	switch s {
	case .Square: return "square"
	case .Landscape_16_9: return "landscape_16_9"
	case .Landscape_4_3: return "landscape_4_3"
	case .Portrait_4_3: return "portrait_4_3"
	case .Square_HD: return "square_hd"
	case .Portrait_16_9: return "portrait_16_9"
	}
	return "landscape_4_3"
}

get_image_size_for_shot_type :: proc(shot: Shot_Type) -> Sdxl_Image_Size {
	switch shot {
	case .Establishing, .Wide, .Aerial:
		return .Landscape_16_9
	case .Medium, .Over_Shoulder:
		return .Landscape_4_3
	case .Close_Up:
		return .Portrait_4_3
	case .Extreme_Close_Up:
		return .Square_HD
	}
	return .Landscape_4_3
}

emotion_name :: proc(e: Emotion) -> string {
	switch e {
	case .Happy: return "happy"
	case .Sad: return "sad"
	case .Angry: return "angry"
	case .Surprised: return "surprised"
	case .Neutral: return "neutral"
	case .Determined: return "determined"
	}
	return "neutral"
}

parse_emotion :: proc(raw: string) -> Emotion {
	lower := strings.to_lower(raw)
	if strings.contains(lower, "happy") || strings.contains(lower, "joy") || strings.contains(lower, "smile") { return .Happy }
	if strings.contains(lower, "sad") || strings.contains(lower, "cry") || strings.contains(lower, "sorrow") { return .Sad }
	if strings.contains(lower, "angry") || strings.contains(lower, "rage") || strings.contains(lower, "furious") { return .Angry }
	if strings.contains(lower, "surpris") || strings.contains(lower, "shock") || strings.contains(lower, "amazed") { return .Surprised }
	if strings.contains(lower, "determin") || strings.contains(lower, "resolv") || strings.contains(lower, "focused") { return .Determined }
	return .Neutral
}
