# Copyright (c) 2024 BigRep GmbH

from typing import TYPE_CHECKING

from UM.Settings.ContainerRegistry import ContainerRegistry

from cura.Machines.ContainerNode import ContainerNode


if TYPE_CHECKING:
    from typing import Dict
    from cura.Machines.MachineNode import MachineNode


class MachineVariantNode(ContainerNode):
    """
    This class represents a machine variant in the container tree. 
    A machine variant is a change to a machine other then a hotend. For example, 
    different build surfaces or additional sensors etc.

    MachineNode     ->    [MachineVariantNode, MachineVariantNode]
    |             \
    VariantNode   VariantNode
    |
    MaterialNode
    |
    QualityNode
    """

    def __init__(self, container_id: str, build_plate: str, machine: "MachineNode") -> None:
        super().__init__(container_id)
        self.machine = machine
        self.build_plate = build_plate

        container_registry = ContainerRegistry.getInstance()
        
        # Store our own name so that we can filter more easily.
        self.machine_variant_name = container_registry.findContainersMetadata(id = container_id)[0]["name"]  
