package click.kamil.examples.statemachine.extended.web;

import click.kamil.examples.statemachine.extended.service.QuirkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class QuirkController {

    @Autowired
    private QuirkService quirkService; // Should resolve to PrimaryQuirkService

    @Autowired
    @Qualifier("customName")
    private QuirkService someService; // Should resolve to NamedQuirkService

    @Autowired
    @Qualifier("qualifierQuirkService")
    private QuirkService anotherService; // Should resolve to QualifierQuirkService

    @Autowired
    private QuirkService fallbackQuirkService; // Should resolve to FallbackQuirkService

    @PostMapping("/api/quirk/primary")
    public void testPrimary() {
        quirkService.doQuirk();
    }

    @PostMapping("/api/quirk/named")
    public void testNamed() {
        someService.doQuirk();
    }

    @PostMapping("/api/quirk/qualifier")
    public void testQualifier() {
        anotherService.doQuirk();
    }

    @PostMapping("/api/quirk/fallback")
    public void testFallback() {
        fallbackQuirkService.doQuirk();
    }
}
