When new File is added copy the last existing commercial block and move by one week. CHAT GTP tried to help

Hi
The idea behind the script.
I add a file to mairlist in to a specific folder element.
Once I do so I want it to copy the newest commercial block which has “Vanessa” in the description advance the dates by one week and put the new file in it.

Chat GTP came up with the following:

// Event handler for file added to specific folder element
procedure OnFileAdded(Sender: TObject; Item: IFileItem);
var
CommercialBlock: IPlaylistItem;
DateTime: TDateTime;
ExistingBlocks: IInterfaceList;
ExistingBlock: IPlaylistItem;
NewestBlock: IPlaylistItem;
NewestDateTime: TDateTime;
ExistingDescription: string;
FolderElementID: string;
begin
// Specify the folder element ID to monitor
FolderElementID := ‘179’;

// Check if the file was added to the specific folder element
if Item.GetParent.GetID = FolderElementID then
begin
ExistingDescription := ‘Vanessa’; // Replace with the description of the existing commercial block

// Find all existing commercial blocks with the same description
ExistingBlocks := Factory.CreateInterfaceList;
Database.FindPlaylistItemsByDescription(ExistingBlocks, ExistingDescription);

// Find the newest commercial block
NewestBlock := nil;
NewestDateTime := 0;
for ExistingBlock in ExistingBlocks do
begin
  DateTime := ExistingBlock.GetPlannedDateTime;
  if DateTime > NewestDateTime then
  begin
    NewestBlock := ExistingBlock;
    NewestDateTime := DateTime;
  end;
end;

// Copy the newest commercial block
if NewestBlock <> nil then
begin
  CommercialBlock := Factory.ClonePlaylistItem(NewestBlock);

  // Get the existing start date and time
  DateTime := NewestBlock.GetPlannedDateTime;

  // Set the start date and time for the commercial block
  DateTime := IncWeek(DateTime, 1); // Add 1 week to the existing date and time
  CommercialBlock.SetPlannedDateTime(DateTime);

  // Add the new file to the commercial block
  CommercialBlock.ClearFiles;
  CommercialBlock.AddFile(Item);

  // Save the changes to the database
  Database.SavePlaylistItem(CommercialBlock);
end;

end;
end;

// Entry point of the script
begin
// Subscribe to the OnFileAdded event
Database.OnFileAdded.Add(OnFileAdded);
end.

The result:
28.06.2023 21:29:36 Fehler Fehler beim Laden des Hintergrund-Scripts Commercial.mls: [Error] (2:46): Unknown type ‘IFileItem’

Any help to get this fixed would be highly appreciated.
Thanks
Stefan