@startuml
skinparam monochrome true
skinparam packageStyle rectangle
skinparam shadowing false

title System Sequence Diagram (SSD) - US010 - Place an order to purchase a property

autonumber

actor "Client" as Client
participant ":System" as System

activate Client

    Client -> System : asks to place an order to purchase a property
    activate System

        System --> Client : shows the agencies' list and asks the client to choose \nthe agency that he wants to see the properties list
    deactivate System

    Client -> System : selects the agency
    activate System

        System --> Client : asks if he wants to filter the properties by sale or rent
    deactivate System

    alt the user selects sale properties

    Client -> System : selects to filter by sale properties
    activate System

        System --> Client : shows the list with properties for sale and asks to select one
    deactivate System

    else the user selects rent properties

    Client -> System : selects to filter by rent properties
    activate System

        System --> Client : shows the list with properties for rent and asks to select one
    deactivate System

    else the user selects no filters

    Client -> System : selects no filters
    activate System

        System --> Client : shows the list of properties for rent and sale by default and asks to select one
    deactivate System

    end

    Client -> System : selects the property
    activate System

        System --> Client : asks to place an order amount
    deactivate System


    alt the client introduces an equal or lower amount than owner set price

    Client -> System : place an amount equal or lower
    activate System

        System --> Client : shows the success of the operation
    deactivate System

    else the client introduces a bigger amount than owner set price

    Client -> System : place a bigger amount
    activate System

        System --> Client : shows the error and asks the client to place an equal or lower amount than the owner set price
    deactivate System

    else the client introduces an invalid amount (not a number)

    Client -> System : place an invalid amount
    activate System

        System --> Client : shows the error and asks the client to submit a valid order amount (number)
    deactivate System

    end

@enduml