src/Project/CatrobatCode/Parser/Bricks/BrickFactory.php
<?php

declare(strict_types=1);

namespace App\Project\CatrobatCode\Parser\Bricks;

use App\Project\CatrobatCode\Parser\Constants;

class BrickFactory
{
  public static function generate(\SimpleXMLElement $brick_xml_properties): mixed
  {
    return match ((string) $brick_xml_properties[Constants::TYPE_ATTRIBUTE]) {
      Constants::BROADCAST_BRICK => new BroadcastBrick($brick_xml_properties),
      Constants::BROADCAST_WAIT_BRICK => new BroadcastWaitBrick($brick_xml_properties),
      Constants::WHEN_BRICK => new WhenBrick($brick_xml_properties),
      Constants::BROADCAST_RECEIVER_BRICK => new BroadcastReceiverBrick($brick_xml_properties),
      Constants::WHEN_BOUNCE_OFF_BRICK => new WhenBounceOffBrick($brick_xml_properties),
      Constants::WHEN_BG_CHANGE_BRICK => new WhenBGChangeBrick($brick_xml_properties),
      Constants::WHEN_CLONED_BRICK => new WhenClonedBrick($brick_xml_properties),
      Constants::WHEN_CONDITION_BRICK => new WhenConditionBrick($brick_xml_properties),
      Constants::WHEN_TOUCH_BRICK => new WhenTouchBrick($brick_xml_properties),
      Constants::WHEN_GAME_PAD_BUTTON_BRICK => new WhenGamepadButtonBrick($brick_xml_properties),
      Constants::WHEN_STARTED_BRICK => new WhenStartedBrick($brick_xml_properties),
      Constants::WAIT_BRICK => new WaitBrick($brick_xml_properties),
      Constants::NOTE_BRICK => new NoteBrick($brick_xml_properties),
      Constants::FOREVER_BRICK => new ForeverBrick($brick_xml_properties),
      Constants::IF_THEN_BRICK, Constants::IF_BRICK => new IfBrick($brick_xml_properties),
      Constants::ELSE_BRICK => new ElseBrick($brick_xml_properties),
      Constants::ENDIF_THEN_BRICK, Constants::ENDIF_BRICK => new EndIfBrick($brick_xml_properties),
      Constants::REPEAT_BRICK => new RepeatBrick($brick_xml_properties),
      Constants::LOOP_END_BRICK => new LoopEndBrick($brick_xml_properties),
      Constants::WAIT_UNTIL_BRICK => new WaitUntilBrick($brick_xml_properties),
      Constants::REPEAT_UNTIL_BRICK => new RepeatUntilBrick($brick_xml_properties),
      Constants::STOP_SCRIPT_BRICK => new StopScriptBrick($brick_xml_properties),
      Constants::SCENE_START_BRICK => new SceneStartBrick($brick_xml_properties),
      Constants::CLONE_BRICK => new CloneBrick($brick_xml_properties),
      Constants::DELETE_THIS_CLONE_BRICK => new DeleteThisCloneBrick($brick_xml_properties),
      Constants::CONTINUE_SCENE_BRICK => new ContinueSceneBrick($brick_xml_properties),
      Constants::EXIT_STAGE_BRICK => new ExitStageBrick($brick_xml_properties),
      Constants::SET_INSTRUMENT_BRICK => new SetInstrumentBrick($brick_xml_properties),
      Constants::PLACE_AT_BRICK => new PlaceAtBrick($brick_xml_properties),
      Constants::SET_X_BRICK => new SetXBrick($brick_xml_properties),
      Constants::SET_Y_BRICK => new SetYBrick($brick_xml_properties),
      Constants::CHANGE_X_BY_N_BRICK => new ChangeXByNBrick($brick_xml_properties),
      Constants::CHANGE_Y_BY_N_BRICK => new ChangeYByNBrick($brick_xml_properties),
      Constants::IF_ON_EDGE_BOUNCE_BRICK => new IfOnEdgeBounceBrick($brick_xml_properties),
      Constants::MOVE_N_STEPS_BRICK => new MoveNStepsBrick($brick_xml_properties),
      Constants::TURN_LEFT_BRICK => new TurnLeftBrick($brick_xml_properties),
      Constants::TURN_RIGHT_BRICK => new TurnRightBrick($brick_xml_properties),
      Constants::POINT_IN_DIRECTION_BRICK => new PointInDirectionBrick($brick_xml_properties),
      Constants::GLIDE_TO_BRICK => new GlideToBrick($brick_xml_properties),
      Constants::GO_N_STEPS_BACK_BRICK => new GoNStepsBackBrick($brick_xml_properties),
      Constants::COME_TO_FRONT_BRICK => new ComeToFrontBrick($brick_xml_properties),
      Constants::VIBRATION_BRICK => new VibrationBrick($brick_xml_properties),
      Constants::SET_PHYSICS_OBJECT_TYPE_BRICK => new SetPhysicsObjectTypeBrick($brick_xml_properties),
      Constants::SET_VELOCITY_BRICK => new SetVelocityBrick($brick_xml_properties),
      Constants::TURN_LEFT_SPEED_BRICK => new TurnLeftSpeedBrick($brick_xml_properties),
      Constants::TURN_RIGHT_SPEED_BRICK => new TurnRightSpeedBrick($brick_xml_properties),
      Constants::SET_GRAVITY_BRICK => new SetGravityBrick($brick_xml_properties),
      Constants::SET_MASS_BRICK => new SetMassBrick($brick_xml_properties),
      Constants::SET_BOUNCE_BRICK => new SetBounceBrick($brick_xml_properties),
      Constants::SET_FRICTION_BRICK => new SetFrictionBrick($brick_xml_properties),
      Constants::POINT_TO_BRICK => new PointToBrick($brick_xml_properties),
      Constants::GO_TO_BRICK => new GoToBrick($brick_xml_properties),
      Constants::SET_ROTATION_STYLE_BRICK => new SetRotationStyleBrick($brick_xml_properties),
      Constants::SET_TEXT_BRICK => new SetTextBrick($brick_xml_properties),
      Constants::PLAY_SOUND_BRICK => new PlaySoundBrick($brick_xml_properties),
      Constants::STOP_ALL_SOUNDS_BRICK => new StopAllSoundsBrick($brick_xml_properties),
      Constants::SET_VOLUME_TO_BRICK => new SetVolumeToBrick($brick_xml_properties),
      Constants::CHANGE_VOLUME_BY_N_BRICK => new ChangeVolumeByNBrick($brick_xml_properties),
      Constants::SPEAK_BRICK => new SpeakBrick($brick_xml_properties),
      Constants::PLAY_SOUND_WAIT_BRICK => new PlaySoundWaitBrick($brick_xml_properties),
      Constants::SPEAK_WAIT_BRICK => new SpeakWaitBrick($brick_xml_properties),
      Constants::ASK_SPEECH_BRICK => new AskSpeechBrick($brick_xml_properties),
      Constants::STOP_SOUND_BRICK => new StopSoundBrick($brick_xml_properties),
      Constants::START_LISTENING_BRICK => new StartListeningBrick($brick_xml_properties),
      Constants::PAUSE_FOR_BEATS_BRICK => new PauseForBeatsBrick($brick_xml_properties),
      Constants::PLAY_DRUM_FOR_BEATS_BRICK => new PlayDrumForBeatsBrick($brick_xml_properties),
      Constants::PLAY_NOTE_FOR_BEATS_BRICK => new PlayNoteForBeatsBrick($brick_xml_properties),
      Constants::SET_LISTENING_LANGUAGE_BRICK => new SetListeningLanguageBrick($brick_xml_properties),
      Constants::SET_TEMPO_BRICK => new SetTempoBrick($brick_xml_properties),
      Constants::CHANGE_TEMPO_BY_N_BRICK => new ChangeTempoByNBrick($brick_xml_properties),
      Constants::SET_LOOK_BRICK => new SetLookBrick($brick_xml_properties),
      Constants::NEXT_LOOK_BRICK => new NextLookBrick($brick_xml_properties),
      Constants::CAMERA_BRICK => new CameraBrick($brick_xml_properties),
      Constants::CHOOSE_CAMERA_BRICK => new ChooseCameraBrick($brick_xml_properties),
      Constants::SET_SIZE_TO_BRICK => new SetSizeToBrick($brick_xml_properties),
      Constants::CHANGE_SIZE_BY_N_BRICK => new ChangeSizeByNBrick($brick_xml_properties),
      Constants::HIDE_BRICK => new HideBrick($brick_xml_properties),
      Constants::SHOW_BRICK => new ShowBrick($brick_xml_properties),
      Constants::SET_TRANSPARENCY_BRICK => new SetTransparencyBrick($brick_xml_properties),
      Constants::CHANGE_TRANSPARENCY_BY_N_BRICK => new ChangeTransparencyByNBrick($brick_xml_properties),
      Constants::SET_BRIGHTNESS_BRICK => new SetBrightnessBrick($brick_xml_properties),
      Constants::CHANGE_BRIGHTNESS_BY_N_BRICK => new ChangeBrightnessByNBrick($brick_xml_properties),
      Constants::SET_COLOR_BRICK => new SetColorBrick($brick_xml_properties),
      Constants::CHANGE_COLOR_BY_N_BRICK => new ChangeColorByNBrick($brick_xml_properties),
      Constants::CLEAR_GRAPHIC_EFFECT_BRICK => new ClearGraphicEffectBrick($brick_xml_properties),
      Constants::FLASH_BRICK => new FlashBrick($brick_xml_properties),
      Constants::PREV_LOOK_BRICK => new PrevLookBrick($brick_xml_properties),
      Constants::ASK_BRICK => new AskBrick($brick_xml_properties),
      Constants::SAY_BUBBLE_BRICK => new SayBubbleBrick($brick_xml_properties),
      Constants::SAY_FOR_BUBBLE_BRICK => new SayForBubbleBrick($brick_xml_properties),
      Constants::THINK_BUBBLE_BRICK => new ThinkBubbleBrick($brick_xml_properties),
      Constants::THINK_FOR_BUBBLE_BRICK => new ThinkForBubbleBrick($brick_xml_properties),
      Constants::SET_BACKGROUND_BRICK => new SetBackgroundBrick($brick_xml_properties),
      Constants::SET_BACKGROUND_BY_INDEX_BRICK => new SetBackgroundByIndexBrick($brick_xml_properties),
      Constants::SET_BACKGROUND_WAIT_BRICK => new SetBackgroundWaitBrick($brick_xml_properties),
      Constants::SET_BACKGROUND_BY_INDEX_AND_WAIT_BRICK => new SetBackgroundByIndexAndWaitBrick($brick_xml_properties),
      Constants::SET_LOOK_BY_INDEX_BRICK => new SetLookByIndexBrick($brick_xml_properties),
      Constants::LOOK_REQUEST_BRICK => new LookRequestBrick($brick_xml_properties),
      Constants::BACKGROUND_REQUEST_BRICK => new BackgroundRequestBrick($brick_xml_properties),
      Constants::COPY_LOOK_BRICK => new CopyLookBrick($brick_xml_properties),
      Constants::DELETE_LOOK_BRICK => new DeleteLookBrick($brick_xml_properties),
      Constants::EDIT_LOOK_BRICK => new EditLookBrick($brick_xml_properties),
      Constants::PAINT_NEW_LOOK_BRICK => new PaintNewLookBrick($brick_xml_properties),
      Constants::SET_VARIABLE_BRICK => new SetVariableBrick($brick_xml_properties),
      Constants::CHANGE_VARIABLE_BRICK => new ChangeVariableBrick($brick_xml_properties),
      Constants::SHOW_TEXT_BRICK => new ShowTextBrick($brick_xml_properties),
      Constants::SHOW_TEXT_COLOR_SIZE_ALIGNMENT_BRICK => new ShowTextColorSizeAlignmentBrick($brick_xml_properties),
      Constants::HIDE_TEXT_BRICK => new HideTextBrick($brick_xml_properties),
      Constants::WRITE_VARIABLE_ON_DEVICE_BRICK => new WriteVariableOnDeviceBrick($brick_xml_properties),
      Constants::READ_VARIABLE_FROM_DEVICE_BRICK => new ReadVariableFromDeviceBrick($brick_xml_properties),
      Constants::ADD_ITEM_LIST_BRICK => new AddItemToUserListBrick($brick_xml_properties),
      Constants::DELETE_ITEM_LIST_BRICK => new DeleteItemOfUserListBrick($brick_xml_properties),
      Constants::INSERT_ITEM_LIST_BRICK => new InsertItemIntoUserListBrick($brick_xml_properties),
      Constants::REPLACE_ITEM_LIST_BRICK => new ReplaceItemInUserListBrick($brick_xml_properties),
      Constants::CLEAR_LIST_BRICK => new ClearUserListBrick($brick_xml_properties),
      Constants::WRITE_LIST_ON_DEVICE_BRICK => new WriteListOnDeviceBrick($brick_xml_properties),
      Constants::READ_LIST_FROM_DEVICE_BRICK => new ReadListFromDeviceBrick($brick_xml_properties),
      Constants::USER_VARIABLE_BRICK => new UserVariableBrick($brick_xml_properties),
      Constants::USER_LIST_BRICK => new UserListBrick($brick_xml_properties),
      Constants::STORE_CSV_INTO_USERLIST_BRICK => new StoreCSVIntoUserListBrick($brick_xml_properties),
      Constants::WEB_REQUEST_BRICK => new WebRequestBrick($brick_xml_properties),
      Constants::FOR_VARIABLE_FROM_TO_BRICK => new ForVariableFromToBrick($brick_xml_properties),
      Constants::READ_VARIABLE_FROM_FILE_BRICK => new ReadVariableFromFileBrick($brick_xml_properties),
      Constants::WRITE_VARIABLE_TO_FILE_BRICK => new WriteVariableToFileBrick($brick_xml_properties),
      Constants::PARAMETERIZED_BRICK => new ParameterizedBrick($brick_xml_properties),
      Constants::PARAMETERIZED_END_BRICK => new ParameterizedEndBrick($brick_xml_properties),
      Constants::FOR_ITEM_IN_USER_LIST_BRICK => new ForItemInUserListBrick($brick_xml_properties),
      Constants::OPEN_URL_BRICK => new OpenUrlBrick($brick_xml_properties),
      Constants::RESET_TIMER_BRICK => new ResetTimerBrick($brick_xml_properties),
      Constants::TOUCH_AND_SLIDE_BRICK => new TouchAndSlideBrick($brick_xml_properties),
      Constants::USER_DEFINED_BRICK => new UserDefinedBrick($brick_xml_properties),
      Constants::USER_DEFINED_RECEIVER_BRICK => new UserDefinedReceiverBrick($brick_xml_properties),
      Constants::PEN_DOWN_BRICK => new PenDownBrick($brick_xml_properties),
      Constants::PEN_UP_BRICK => new PenUpBrick($brick_xml_properties),
      Constants::SET_PEN_SIZE_BRICK => new SetPenSizeBrick($brick_xml_properties),
      Constants::SET_PEN_COLOR_BRICK => new SetPenColorBrick($brick_xml_properties),
      Constants::STAMP_BRICK => new StampBrick($brick_xml_properties),
      Constants::CLEAR_BACKGROUND_BRICK => new ClearBackgroundBrick($brick_xml_properties),
      Constants::LEGO_NXT_MOTOR_TURN_ANGLE_BRICK => new LegoNxtMotorTurnAngleBrick($brick_xml_properties),
      Constants::LEGO_NXT_MOTOR_STOP_BRICK => new LegoNxtMotorStopBrick($brick_xml_properties),
      Constants::LEGO_NXT_MOTOR_MOVE_BRICK => new LegoNxtMotorMoveBrick($brick_xml_properties),
      Constants::LEGO_NXT_PLAY_TONE_BRICK => new LegoNxtPlayToneBrick($brick_xml_properties),
      Constants::LEGO_EV3_MOTOR_STOP_BRICK => new LegoEV3MotorStopBrick($brick_xml_properties),
      Constants::LEGO_EV3_MOTOR_MOVE_BRICK => new LegoEV3MotorMoveBrick($brick_xml_properties),
      Constants::LEGO_EV3_MOTOR_PLAY_TONE_BRICK => new LegoEV3MotorPlayToneBrick($brick_xml_properties),
      Constants::LEGO_EV3_MOTOR_TURN_ANGLE_BRICK => new LegoEV3MotorTurnAngleBrick($brick_xml_properties),
      Constants::LEGO_EV3_SET_LED_BRICK => new LegoEV3SetLedBrick($brick_xml_properties),
      Constants::AR_DRONE_EMERGENCY_BRICK => new DroneEmergencyBrick($brick_xml_properties),
      Constants::AR_DRONE_MOVE_BACKWARD_BRICK => new DroneMoveBackwardBrick($brick_xml_properties),
      Constants::AR_DRONE_MOVE_DOWN_BRICK => new DroneMoveDownBrick($brick_xml_properties),
      Constants::AR_DRONE_MOVE_FORWARD_BRICK => new DroneMoveForwardBrick($brick_xml_properties),
      Constants::AR_DRONE_MOVE_LEFT_BRICK => new DroneMoveLeftBrick($brick_xml_properties),
      Constants::AR_DRONE_MOVE_RIGHT_BRICK => new DroneMoveRightBrick($brick_xml_properties),
      Constants::AR_DRONE_MOVE_UP_BRICK => new DroneMoveUpBrick($brick_xml_properties),
      Constants::AR_DRONE_SWITCH_CAMERA_BRICK => new DroneSwitchCameraBrick($brick_xml_properties),
      Constants::AR_DRONE_TAKE_OFF_LAND_BRICK => new DroneTakeOffLandBrick($brick_xml_properties),
      Constants::AR_DRONE_TURN_LEFT_BRICK => new DroneTurnLeftBrick($brick_xml_properties),
      Constants::AR_DRONE_TURN_RIGHT_BRICK => new DroneTurnRightBrick($brick_xml_properties),
      Constants::AR_DRONE_FLIP_BRICK => new DroneFlipBrick($brick_xml_properties),
      Constants::AR_DRONE_PLAYED_ANIMATION_BRICK => new DronePlayedAnimationBrick($brick_xml_properties),
      Constants::JUMP_SUMO_ANIMATIONS_BRICK => new JumpingSumoAnimationBrick($brick_xml_properties),
      Constants::JUMP_SUMO_JUMP_HIGH_BRICK => new JumpingSumoJumpHighBrick($brick_xml_properties),
      Constants::JUMP_SUMO_JUMP_LONG_BRICK => new JumpingSumoJumpLongBrick($brick_xml_properties),
      Constants::JUMP_SUMO_MOVE_BACKWARD_BRICK => new JumpingSumoMoveBackwardBrick($brick_xml_properties),
      Constants::JUMP_SUMO_MOVE_FORWARD_BRICK => new JumpingSumoMoveForwardBrick($brick_xml_properties),
      Constants::JUMP_SUMO_NO_SOUND_BRICK => new JumpingSumoNoSoundBrick($brick_xml_properties),
      Constants::JUMP_SUMO_ROTATE_LEFT_BRICK => new JumpingSumoRotateLeftBrick($brick_xml_properties),
      Constants::JUMP_SUMO_ROTATE_RIGHT_BRICK => new JumpingSumoRotateRightBrick($brick_xml_properties),
      Constants::JUMP_SUMO_SOUND_BRICK => new JumpingSumoSoundBrick($brick_xml_properties),
      Constants::JUMP_SUMO_TAKING_PICTURE_BRICK => new JumpingSumoTakingPictureBrick($brick_xml_properties),
      Constants::JUMP_SUMO_TURN_BRICK => new JumpingSumoTurnBrick($brick_xml_properties),
      Constants::ARDUINO_SEND_DIGITAL_VALUE_BRICK => new ArduinoSendDigitalValueBrick($brick_xml_properties),
      Constants::ARDUINO_SEND_PMW_VALUE_BRICK => new ArduinoSendPMWValueBrick($brick_xml_properties),
      Constants::RASPI_IF_LOGIC_BEGIN_BRICK => new RaspiIfLogicBeginBrick($brick_xml_properties),
      Constants::RASPI_SEND_DIGITAL_VALUE_BRICK => new RaspiSendDigitalValueBrick($brick_xml_properties),
      Constants::RASPI_PWM_BRICK => new RaspiPwmBrick($brick_xml_properties),
      Constants::WHEN_RASPI_PIN_CHANGED_BRICK => new WhenRaspiPinChangedBrick($brick_xml_properties),
      Constants::STITCH_BRICK => new StitchBrick($brick_xml_properties),
      Constants::RUNNING_STITCH_BRICK => new RunningStitchBrick($brick_xml_properties),
      Constants::STOP_RUNNING_STITCH_BRICK => new StopRunningStitchBrick($brick_xml_properties),
      Constants::TRIPLE_STITCH_BRICK => new TripleStitchBrick($brick_xml_properties),
      Constants::ZIG_ZAG_STITCH_BRICK => new ZigZagStitchBrick($brick_xml_properties),
      Constants::SEW_UP_BRICK => new SewUpBrick($brick_xml_properties),
      Constants::WRITE_EMBROIDERY_TO_FILE_BRICK => new WriteEmbroideryToFileBrick($brick_xml_properties),
      Constants::PHIRO_MOTOR_MOVE_FORWARD_BRICK => new PhiroMotorMoveForwardBrick($brick_xml_properties),
      Constants::PHIRO_MOTOR_MOVE_BACKWARD_BRICK => new PhiroMotorMoveBackwardBrick($brick_xml_properties),
      Constants::PHIRO_MOTOR_STOP_BRICK => new PhiroMotorStopBrick($brick_xml_properties),
      Constants::PHIRO_PLAY_TONE_BRICK => new PhiroPlayToneBrick($brick_xml_properties),
      Constants::PHIRO_RGB_LIGHT_BRICK => new PhiroRgbLightBrick($brick_xml_properties),
      Constants::PHIRO_IF_LOGIC_BEGIN_BRICK => new PhiroIfLogicBeginBrick($brick_xml_properties),
      Constants::SET_NFC_TAG_BRICK => new SetNfcTagBrick($brick_xml_properties),
      Constants::WHEN_NFC_BRICK => new WhenNfcBrick($brick_xml_properties),
      Constants::ASSERT_EQUALS_BRICK => new AssertEqualsBrick($brick_xml_properties),
      Constants::WAIT_TILL_IDLE_BRICK => new WaitTillIdleBrick($brick_xml_properties),
      Constants::TAP_AT_BRICK => new TapAtBrick($brick_xml_properties),
      Constants::FINISH_STAGE_BRICK => new FinishStageBrick($brick_xml_properties),
      Constants::ASSERT_USER_LISTS_BRICK => new AssertUserListsBrick($brick_xml_properties),
      Constants::TAP_FOR_BRICK => new TapForBrick($brick_xml_properties),
      Constants::LOOP_ENDLESS_BRICK => new LoopEndlessBrick($brick_xml_properties),
      default => new UnknownBrick($brick_xml_properties),
    };
  }
}
