package com.reading.platform.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 资源项实体
 */
@Data
@TableName("t_resource_item")
@Schema(description = "资源项")
public class ResourceItem {

    @Schema(description = "资源项 ID", accessMode = Schema.AccessMode.READ_ONLY)
    @TableId(type = IdType.ASSIGN_ID)
    private String id;

    @Schema(description = "资源库 ID", requiredMode = Schema.RequiredMode.REQUIRED)
    private String libraryId;

    @Schema(description = "租户 ID", accessMode = Schema.AccessMode.READ_ONLY)
    private String tenantId;

    @Schema(description = "资源类型", example = "picture_book", requiredMode = Schema.RequiredMode.REQUIRED)
    private String type;

    @Schema(description = "资源名称", example = "《好饿的毛毛虫》", requiredMode = Schema.RequiredMode.REQUIRED)
    private String name;

    @Schema(description = "资源编码", example = "PB001")
    private String code;

    @Schema(description = "资源描述")
    private String description;

    @Schema(description = "数量", example = "10")
    private Integer quantity;

    @Schema(description = "可用数量", example = "8")
    private Integer availableQuantity;

    @Schema(description = "存放位置", example = "A 区 -1 架 -2 层")
    private String location;

    @Schema(description = "状态", example = "available", allowableValues = {"available", "borrowed", "lost"})
    private String status;

    @Schema(description = "创建人用户名", accessMode = Schema.AccessMode.READ_ONLY)
    @TableField(fill = FieldFill.INSERT)
    private String createdBy;

    @Schema(description = "创建时间", accessMode = Schema.AccessMode.READ_ONLY)
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    @Schema(description = "更新时间", accessMode = Schema.AccessMode.READ_ONLY)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    @Schema(description = "更新人用户名", accessMode = Schema.AccessMode.READ_ONLY)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updatedBy;

    @Schema(description = "是否删除 0-未删除 1-已删除", accessMode = Schema.AccessMode.READ_ONLY)
    @TableLogic
    private Integer deleted;

}
