package cn.bunny.dao.dto.financial.bill.admin;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Schema(name = "BillAddDto对象", title = "账单信息添加内容", description = "账单信息添加内容")
public class BillAddDto {

    @Schema(name = "userId", title = "绑定的用户id")
    private Long userId;

    @Schema(name = "username", title = "类型：1 - 收入，-1 - 支出")
    @NotNull(message = "类型不能为空")
    @Min(value = -1, message = "类型格式不正确")
    @Max(value = 1, message = "类型格式不正确")
    private Byte type;

    @Schema(name = "amount", title = "金额")
    @NotNull(message = "金额不能为空")
    @Min(value = 0, message = "金额格式不正确")
    private BigDecimal amount;

    @Schema(name = "description", title = "描述")
    private String description;

    @Schema(name = "transactionDate", title = "交易日期")
    @NotNull(message = "交易日期不能为空")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime transactionDate;

    @Schema(name = "categoryId", title = "类别id")
    @NotNull(message = "类别id不能为空")
    private Long categoryId;

}