@startuml
'https://plantuml.com/sequence-diagram

class App {
    start()
    main()
}

class InventoryTrackerController {

    inventoryTrackerTable: TableView<InventoryItem> -- FXML
    itemColumn: TableColumn<InventoryItem, String> -- FXML
    serialNumberColumn: TableColumn<InventoryItem, String> -- FXML
    priceColumn: TableColumn<InventoryItem, String> -- FXML
    addItemButton: Button -- FXML
    saveAsButton: MenuItem -- FXML
    loadButton: MenuItem -- FXML
    removeItemButton: Button -- FXML
    fileMenuButton: MenuButton -- FXML
    itemPriceTextField: TextField -- FXML
    itemSerialNumberTextField: TextField -- FXML
    itemNameTextField: TextField -- FXML
    searchTextField: TextField -- FXML
    clearInventoryButton: Button -- FXML


    helpButton: Button -- FXML

    fileManger: FileManager
    fileChooser: FileChooser
    serialNumbers: Set
    inventoryItems: ObservableList<InventoryItem>

    + addItemButtonClicked(): Adds a new inventory item to table
    + alreadyInSet(Set<String>, String, ObservableList<InventoryItem>): Determines if a serial number is already in the set
    + isCorrectNameLength(Integer name): Returns true if the name is in the correct length requirements
    + isCorrectSerialNumberFormat(String): Returns true if the serial number is in the correct format
    + isCorrectSerialNumberLength(String): Returns true if the serial number is the correct length
    + isCorrectPriceFormat(String): Returns true if the price is the correct format
    + setItems(ObservableList<InventoryItem> items, String, String, String): Sets values into an ObservableList
    + priceFormat(Double): Formats the price into an acceptable currency format
    - clearTextFields(): Clears all the text fields in the gui
    + toInvalidNameController(): Switches scene to InvalidNameController.fxml
    + toInvalidSerialNumberController(): Switches scene to InvalidSerialNumberController.fxml
    + toInvalidPriceController(): Switches scene to InvalidPriceController.fxml
    + toDuplicateItemController(): Switches scene to DuplicateItemController.fxml

    + helpButtonClicked():

    + fileMenuButtonClicked(): Signifies that the file menu was opened
    + loadButtonClicked(): Loads information from a chosen file to the TableView
    + removeItemButtonClicked(): Removes a selected item from the TableView
    + deleteItem(): Removes item from Observable list and from Set
    + setToNull(InventoryItem): Sets all fields of an InventoryItem to null
    + saveAsButtonClicked(): Saves the items in the TableView to an external file
    - searchFindsItem(InventoryItem, String): Returns true if the user's search is in an InventoryItem
    - filterList(ObservableList<InventoryItem>, String): Adds to a filtered list if the searched item was found
    + clearInventoryButtonClicked(): Clears all content in the TableView
    + clearEntireInventory(ObservableList<InventoryItem>): Returns and clears an ObservableList
    + clearSerialNumSet(Set<String>): Returns and clears a set
    + initialize(): initializes the TableView
}

class InventoryItem {
    itemName: String
    itemSerialNumber: String
    itemPrice: String

    + inventoryItem(): constructor
    + getItemName()
    + setItemName(String)
    + getItemSerialNumber()
    + setItemSerialNumber(String)
    + getItemPrice())
    + setItemPrice(String
}

class DuplicateItemController {
    okbutton: Button - FXML

    + okButtonPressed(): Returns scene to InventoryTrackerController.fxml
    + initialize(): Initializes the button
}

class InvalidNameController {
    okButton: Button - FXML

    + okButtonPressed(): Returns scene to InventoryTrackerController.fxml
    + initialize(): Initializes the button
}

class InvalidPriceController {
    okButton: Button - FXML

    + okButtonPressed(): Returns scene to InventoryTrackerController.fxml
    + initialize(): Initializes the button
}

class InvalidSerialNumberController {
    okButton: Button - FXML

    + okButtonPressed(): Returns scene to InventoryTrackerController.fxml
    + initialize(): Initializes the button
}

class FileManager {
    + toJson(List<InventoryItem>): Converts a list to JSON
    + saveToJSONFile(String, File): Saves a JSON string to a JSON file
    + fromJSON(File): Converts a JSON string to an object
    + addToObservableList(ArrayList<String>): Parses the strings in the ArrayList and returns them as an ObservableList
    + addToSet(ObservableList<InventoryItem>): Adds items from an ObservableList to the Set
    + loadFileStrings(File): Adds the strings from a .txt to an ArrayList
    + parseStrings(String): Splits the strings from a .txt at the tabs (\t)
    + loadHTML(File): Adds the strings from a .html to an ArrayList
    + startScanner(Scanner): Makes the scanner start at a certain point in the .html document
    + parseHTMLStrings(String): Returns the data inside the HTML table
    + addToObservableListHTML(ArrayList<String>): Returns an ObservableList created from an HTML file
    + observableToList(ObservableList<InventoryItem>): Converts observable list to a regular list
    + saveToTXT(File, List<InventoryItem>): Saves items to a .txt files
    + generateHeader(File, List<InventoryItem>): Generates the contents to save to a .html file
    + generateHead(File): Creates a header to save
    + generateBody(List<InventoryItem>): Creates the body information to save to a .html file
    + writeToHTMLFile(File, String): Prints information to the .html file
}

javafx.Application <|- App
App *--> InventoryTrackerController
App *--> InventoryItem
InventoryItem - InventoryTrackerController
InventoryTrackerController -- DuplicateItemController
InventoryTrackerController -- InvalidNameController
InventoryTrackerController -- InvalidSerialNumberController
InventoryTrackerController -- InvalidPriceController
InventoryTrackerController *--> FileManager

@enduml