--- @class Faction
local Faction = {}
Faction.name = ""
Faction.characters = {}
Faction.style = {}

--- some sort of global variable :clown:
--- @type table<string, Faction>
FactionList = {}

--- @param name string
function AddFaction(name)
    FactionList[name] = Faction { name = name }
end

--- @param name string
--- @param character table
function AddCharacter(name, character)
    if FactionList[name] == nil then
        print("Cannot add character to faction ", name, "\nFaction does not exist!")
    else
        FactionList[name]:append(character)
    end
end

--- @param name string
--- @param character Character
function RemoveCharacter(name, character)
    if FactionList[name].characters[character.name] == nil then
        print("I cant remove character in Faction ", name, ", because this character doesnt exist!")
    end
    FactionList[name]:remove(character)
end

--- @param character Character
function Faction:append(character)
    self.characters[character.name] = character
end

--- @param character Character
function Faction:remove(character)
    self.characters[character.name] = nil
end
