"""Constants for workflow processing."""

# Built-in ComfyUI nodes (core nodes that don't require custom installation)
BUILTIN_NODES = {
    # Loaders
    "CheckpointLoaderSimple",
    "CheckpointLoader",
    "LoraLoader",
    "VAELoader",
    "CLIPLoader",
    "UNETLoader",
    "ControlNetLoader",
    "DiffusersLoader",
    "unCLIPCheckpointLoader",
    # Conditioning
    "CLIPTextEncode",
    "CLIPTextEncodeSDXL",
    "CLIPTextEncodeSDXLRefiner",
    "ConditioningCombine",
    "ConditioningConcat",
    "ConditioningSetArea",
    "ConditioningSetAreaPercentage",
    "ConditioningSetMask",
    "ConditioningSetTimestepRange",
    "ConditioningAverage",
    "ConditioningZeroOut",
    # Sampling
    "KSampler",
    "KSamplerAdvanced",
    "KSamplerSelect",
    "SamplerCustom",
    "SplitSigmas",
    "FlipSigmas",
    # Latent
    "EmptyLatentImage",
    "LatentUpscale",
    "LatentUpscaleBy",
    "LatentComposite",
    "LatentBlend",
    "LatentFromBatch",
    "RepeatLatentBatch",
    "LatentCrop",
    "SetLatentNoiseMask",
    "LatentCompositeMasked",
    # Image
    "VAEDecode",
    "VAEEncode",
    "VAEDecodeTiled",
    "VAEEncodeTiled",
    "SaveImage",
    "PreviewImage",
    "LoadImage",
    "LoadImageMask",
    "ImageScale",
    "ImageScaleBy",
    "ImageInvert",
    "ImageBatch",
    "ImagePadForOutpaint",
    "ImageBlend",
    "ImageBlur",
    "ImageQuantize",
    "ImageSharpen",
    "ImageScaleToTotalPixels",
    "ImageCompositeMasked",
    "ImageColorToMask",
    "ImageToMask",
    "MaskToImage",
    "SolidMask",
    "InvertMask",
    "CropMask",
    "MaskComposite",
    "FeatherMask",
    "GrowMask",
    # ControlNet
    "ControlNetApply",
    "ControlNetApplyAdvanced",
    "ControlNetApplySD3",
    "ControlNetInpaintingAliMamaApply",
    # CLIP
    "CLIPVisionLoader",
    "CLIPVisionEncode",
    "CLIPSetLastLayer",
    "CLIPMergeSimple",
    "CLIPSave",
    # Model
    "ModelSamplingDiscrete",
    "ModelSamplingContinuousEDM",
    "ModelSamplingContinuousV",
    "ModelSamplingStableCascade",
    "ModelSamplingSD3",
    "ModelSamplingAuraFlow",
    "ModelSamplingFlux",
    "RescaleCFG",
    "PatchModelAddDownscale",
    "PerturbedAttentionGuidance",
    "SDTurboScheduler",
    "FreeU",
    "FreeU_V2",
    "ModelMergeSimple",
    "ModelMergeBlocks",
    "ModelMergeSubtract",
    "ModelMergeAdd",
    "ModelSave",
    # Primitives
    "PrimitiveNode",
    "Reroute",
    "Note",
    # Input/UI
    "TextInput_",
    # Utility
    "LoraLoaderModelOnly",
    "HypernetworkLoader",
    "PhotoMakerLoader",
    "PhotoMakerEncode",
    "InstantIDModelLoader",
    "InstantIDFaceAnalysis",
    "InstantIDApplyAdvanced",
    "ApplyInstantID",
}

# Common model file extensions
MODEL_EXTENSIONS = {
    ".safetensors",
    ".ckpt",
    ".pt",
    ".pth",
    ".bin",
    ".onnx",
}

# Workflow format schemas
WORKFLOW_SCHEMA_VERSION = "1.0"
SUPPORTED_FORMATS = {"api", "ui"}

# Node connection types
CONNECTION_TYPES = {
    "MODEL",
    "CLIP",
    "VAE",
    "CONDITIONING",
    "LATENT",
    "IMAGE",
    "MASK",
    "CONTROL_NET",
    "FLOAT",
    "INT",
    "STRING",
    "BOOLEAN",
}
