package com.example.pc_spring_rest;

import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(path="/now", produces={"application/json", "text/plain"})
public class TimeInfoController {

    @GetMapping
    public TimeInfo now() {
        return TimeInfo.now();
    }

    @GetMapping("/year")
    public int getYear() {
        return TimeInfo.now().getYear();
    }

    @GetMapping("/month")
    public int getMonth() {
        return TimeInfo.now().getMonth();
    }

    @GetMapping("/day")
    public int getDay() {
        return TimeInfo.now().getDay();
    }

    @GetMapping("/hour")
    public int getHour() {
        return TimeInfo.now().getHour();
    }

    @GetMapping("/minute")
    public int getMinute() {
        return TimeInfo.now().getMinute();
    }

    @GetMapping("/second")
    public int getSecond() {
        return TimeInfo.now().getSecond();
    }

    @GetMapping("/long")
    public String getTextLong() {
        return TimeInfo.now().getTextLong();
    }

    @GetMapping("/short")
    public String getTextShort() {
        return TimeInfo.now().getTextShort();
    }

    @GetMapping("/iso")
    public String getTextISO() {
        return TimeInfo.now().getTextISO();
    }
}
