package cn.lihongjie.coal.deviceWorkOrder.dto;

import cn.lihongjie.coal.base.dto.OrgCommonDto;
import cn.lihongjie.coal.common.DictCode;
import cn.lihongjie.coal.device.dto.DeviceDto;
import cn.lihongjie.coal.deviceWorkOrderDetail.dto.DeviceWorkOrderDetailDto;
import cn.lihongjie.coal.pojoProcessor.DictTranslate;
import cn.lihongjie.coal.user.entity.UserEntity;

import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;

import lombok.Data;

import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.Comment;

import java.time.LocalDateTime;
import java.util.List;

@Data
public class DeviceWorkOrderDto extends OrgCommonDto {

    @Comment("提单人名称")
    private String proposerName;

    @Comment("提单人联系方式")
    private String proposerContact;


    @ManyToOne
    private DeviceDto device;

    @Comment("工单时间-开始时间")
    private LocalDateTime time;


    @Comment("工单时间-结束时间")
    private LocalDateTime time2;

    @Comment("负责人")
    private String worker;

    @Comment("工单类型")
    private String type;

    @DictTranslate(dictKey =  DictCode.DEVICE_WORKORDER_TYPE)
    private String typeName;

    @Comment("工单状态")
    private String orderStatus;

    @DictTranslate(dictKey =  DictCode.DEVICE_WORKORDER_STATUS)
    private String orderStatusName;

    @Comment("归档状态")
    @ColumnDefault("'0'")
    private String archiveStatus;

    @DictTranslate(dictKey = DictCode.ARCHIVESTATUS)
    private String archiveStatusName;

    private List<DeviceWorkOrderDetailDto> details;


    @OneToMany
    private List<UserEntity> workers;
}
