package ru.ulstu.odinexample.model;

import ru.ulstu.core.util.DateUtils;
import ru.ulstu.odin.model.annotation.OdinCaption;
import ru.ulstu.odin.model.annotation.OdinDate;
import ru.ulstu.odin.model.annotation.OdinNumeric;

import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date;

public class OdinExampleListDto {
    @OdinCaption("instant")
    @OdinDate(type = OdinDate.OdinDateType.DATETIME)
    private Instant instant;
    @OdinCaption("date")
    private Date date;
    @OdinCaption("localdate")
    private LocalDate localDate;
    @OdinCaption("localtime")
    @OdinDate(type = OdinDate.OdinDateType.TIME)
    private LocalTime localTime;
    @OdinCaption("localdatetime")
    @OdinDate(type = OdinDate.OdinDateType.DATETIME)
    private LocalDateTime localDateTime;
    @OdinCaption("int")
    private int intval;
    @OdinCaption("int+settings")
    @OdinNumeric(precision = 5, scale = 2)
    private int intvalset;
    @OdinCaption("float")
    private float floatval;
    @OdinCaption("double")
    private double aDouble;
    @OdinCaption("double+set")
    @OdinNumeric(precision = 5, scale = 3)
    private double aDoubles;
    @OdinCaption("int+positive")
    @OdinNumeric(positiveOnly = true, scale = 2)
    private int invalpos;

    public OdinExampleListDto() {
        this.instant = Instant.now();
        this.date = new Date();
        this.localDate = LocalDate.now();
        this.localTime = LocalTime.now();
        this.localDateTime = LocalDateTime.now();
        intval = -134;
        intvalset = 1343423232;
        floatval = 2323.44F;
        aDouble = -232323.43434;
        aDoubles = 0.456456456;
        invalpos = -23232323;
    }


    public Date getInstant() {
        return DateUtils.instantToDate(instant);
    }

    public Date getDate() {
        return date;
    }

    public Date getLocalDate() {
        return DateUtils.localDateToDate(localDate);
    }

    public Date getLocalTime() {
        return DateUtils.localTimeToDate(localTime);
    }

    public Date getLocalDateTime() {
        return DateUtils.localDateTimeToDate(localDateTime);
    }

    public int getIntval() {
        return intval;
    }

    public int getIntvalset() {
        return intvalset;
    }

    public float getFloatval() {
        return floatval;
    }

    public double getaDouble() {
        return aDouble;
    }

    public double getaDoubles() {
        return aDoubles;
    }

    public int getInvalpos() {
        return invalpos;
    }

}
