---
# System prepended metadata

title: UML diagram Gardening Project

---


# UML diagram Gardening Project
```plantuml
@startuml
allowmixing
    class Bed{
        +plants:List[Plant]
        +needs_water:bool
        +location:str
        +water_level:float
        #{static}WATERING_THRESHOLD
        ---
        +__init__(location:str)
        +plant_plant(plant: Plant)
        +water(added_water: int = 1)
        +update()
        +harvest()  
        +remove_dead_plants()
        +__repr__()
        +__str__()
        
    }
    
    abstract Plant{
        +species:str
        +growth_factor:float
        +size:int
        +dead:bool
        +emoji:str
        +{static}plant_type:str
        +{static}PLANT_BOOK: str
        ---
        +__init__(species: str, 
                    growth_factor: float, 
                    **plant_infos)
        +grow()
        +{abstract}harvest()
        +{static}new_plant(name:str)
        +{static}update_plant_book(plants_file:str)
        +__repr__()
        +__str__()
    }
    note right of Plant::new_plant(name:str)
         This is a classmethod
    end note
    note right of Plant::update_plant_book(plants_file:str)
         This is a classmethod
    end note
    
    class FruitBearingPlant{
        +fruit_template:Fruit
        +fruits:List[Fruit]
        +{static}plant_type:str="fruity"
        ---
        +__init__(species: str, 
                    growth_factor: float, 
                    fruit_calories:int, 
                    **plant_infos)
        +harvest()
        +grow()
        +pick()
        +__str__()
    }

    class RootVegetable{
        +{static}plant_type:str="rooty"
        #root:Root
        #plant_size_to_root_length_factor:float
        ---
        +__init__(species: str, 
                    growth_factor: float, 
                    calories_per_root_length: int,
                    plant_size_to_root_length_factor: float,        
                    **plant_infos)
        +harvest()
        +grow()
        +__str__()
    }
    
    
    exception NoMoreFruitsError{}
    exception DeadPlantError{}
    exception NoMoreEnergyError{}
    exception ConfusionError{}

    struct Fruit{
        +name:str
        +calories:int
    }

 

    struct Root{
        +name:str
        +calories_per_length:int
        +length:float
        +calories:float
    }

    class Garden{
        +location:str
        +beds:List[Bed]
        #gardeners:List[Gardener]
        #garden_guard:Gardener
        #days_until_a_new_garden_will_be_choosen:int
        ---
        +__init__(location: str)
        +accept(new_gardener:Gardener)
        +let_a_day_pass()
        +celebrate_garden_day()
        #choose_new_garden_guard()
    }
    
    class Gardener{
        +name:str
        +beds:List[Bed]
        +energy:int
        +gardening_skills:int
        +{static}MAX_ENERGY:int
        +{static}WATERING_ENERGY:int
        +{static}PLANTING_ENERGY:int
        +{static}BED_BUILDING_ENERGY:int
        +{static}HARVESTING_ENERGY:int
        +{static}DEAD_PLANT_REMOVAL_ENERGY:int
        #inventory:List[Bed|Plant]
        ---
        +__init__(name: str)
        +water(bed:Bed, amount:int)
        +plant(plant:Plant, bed:Bed)
        +build(location:str)
        +pick(plant:Plant)
        +harvest(bed_or_plant:Bed|Plant)
        +remove_dead_plants(bed:Bed)
        +eat(fruit:str|Fruit|Root)
        +sleep()
        +garden()
    }
    
    class GardenHelpers{
        ---
        +{static}create_bar(symbol:str, length:int, fill:int)
    }
    json "<b>example_plant.json" as JSON {
        "strawberry": {
            "plant_type": "fruity",
            "growth_factor": 1.1,
            "max_size": 10, 
            "water_needed": 2,
            "emoji": "emoji",
            "fruit_calories": 33,
            "fruits_per_day": 5,
            "fruits_per_size": 3
        },

        "carrot": {
            "plant_type": "rooty",
            "growth_factor": 1.1,
            "max_size": 10, 
            "water_needed": 2,
            "emoji": "emoji",
            "minimum_harvest_size": 7,
            "calories_per_root_length": 10,
            "plant_size_to_root_length_factor": 5
        }
    }
    note top of JSON
         This is an example "plant.json" file used by the Plant class
    end note 


    Plant <|-- "0.." FruitBearingPlant: inheritance
    Plant <|-- "0.." RootVegetable: inheritance
    FruitBearingPlant *-- "0.." Fruit: composition
    NoMoreFruitsError <-- FruitBearingPlant: uses
    RootVegetable *-- "0.." Root: composition
    DeadPlantError <-- Bed: uses
    Bed *-- "0.." Plant: composition
    Gardener *-- "0.." Bed: composition
    Gardener *-- "0.." Plant: composition
    NoMoreEnergyError <-- Gardener: uses
    NoMoreFruitsError <-- Gardener: uses
    Garden *-- "0.." Gardener: composition
    Garden *-- "0.." Bed: composition
    ConfusionError <-- Garden: uses

    GardenHelpers <-- Bed: uses
    GardenHelpers <-- RootVegetable: uses
    GardenHelpers <-- FruitBearingPlant: uses

    JSON <-- Plant: uses

    

@enduml
```