sequenceDiagram
    participant {{ACTOR_1}} as {{ACTOR_1_NAME}}
    participant {{ACTOR_2}} as {{ACTOR_2_NAME}}
    participant {{ACTOR_3}} as {{ACTOR_3_NAME}}
    participant {{ACTOR_4}} as {{ACTOR_4_NAME}}

    {{ACTOR_1}}->>{{ACTOR_2}}: {{STEP_1_ACTION}}
    activate {{ACTOR_2}}

    {{ACTOR_2}}->>{{ACTOR_3}}: {{STEP_2_ACTION}}
    activate {{ACTOR_3}}

    {{ACTOR_3}}->>{{ACTOR_4}}: {{STEP_3_ACTION}}
    {{ACTOR_4}}-->>{{ACTOR_3}}: {{STEP_3_RESPONSE}}

    {{ACTOR_3}}-->>{{ACTOR_2}}: {{STEP_2_RESPONSE}}
    deactivate {{ACTOR_3}}

    alt {{SUCCESS_CONDITION}}
        {{ACTOR_2}}-->>{{ACTOR_1}}: {{SUCCESS_RESPONSE}}
        {{ACTOR_1}}->>{{ACTOR_1}}: {{SUCCESS_ACTION}}
    else {{FAILURE_CONDITION}}
        {{ACTOR_2}}-->>{{ACTOR_1}}: {{ERROR_RESPONSE}}
        {{ACTOR_1}}->>{{ACTOR_1}}: {{ERROR_ACTION}}
    end

    deactivate {{ACTOR_2}}

    %% Optional: Loop example
    %% loop {{LOOP_CONDITION}}
    %%     {{ACTOR}}->>{{TARGET}}: {{LOOP_ACTION}}
    %% end

    %% Optional: Note example
    %% Note over {{ACTOR_1}},{{ACTOR_2}}: {{NOTE_TEXT}}

%% Template Variables:
%% {{ACTOR_*}} - Short identifier for participant
%% {{ACTOR_*_NAME}} - Display name for participant
%% {{STEP_*_ACTION}} - Action/message description
%% {{STEP_*_RESPONSE}} - Response message
%% {{SUCCESS_CONDITION}} - Condition for success path
%% {{FAILURE_CONDITION}} - Condition for error path
%% {{SUCCESS_RESPONSE}} - Success message
%% {{SUCCESS_ACTION}} - Action on success
%% {{ERROR_RESPONSE}} - Error message
%% {{ERROR_ACTION}} - Action on error

%% Notes:
%% - Use activate/deactivate to show processing time
%% - Use alt/else for conditional flows
%% - Use loop for repeated actions
%% - Use Note over for explanations
%% - Solid arrow (->>) for requests
%% - Dashed arrow (-->>) for responses
