package com.izouma.jmrh.dto;

import com.izouma.jmrh.domain.DockingRecord;
import com.izouma.jmrh.domain.OrgInfo;
import com.izouma.jmrh.domain.ResSnDProperty;
import com.izouma.jmrh.domain.ResourceSupplyAndDemand;
import com.izouma.jmrh.enums.AuditStatus;
import com.izouma.jmrh.enums.ConversationStatus;
import com.izouma.jmrh.enums.DockingStatus;
import com.izouma.jmrh.enums.ResSnDType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

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

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SndDTO {
    private Long id;

    private String name;

    private Long orgId;

    private Long publishersId;

    private LocalDateTime expireTime;

    private String contact;

    private String phone;

    private String address;

    private AuditStatus status;

    private List<String> images;

    private ResSnDType type;

    private String description;

    private String details;

    private List<ResSnDProperty> resSnDPropertyList;

    private OrgInfo orgInfo;

    private Integer count;

    private DockingStatus dockingStatus;

    private Long conversationId;

    public SndDTO(ResourceSupplyAndDemand snd, DockingRecord dockingRecord) {
        BeanUtils.copyProperties(snd, this);
        if (dockingRecord != null) {
            dockingStatus = dockingRecord.getStatus();
        }
    }
}
