package com.yaoai.api.dto.team;

import com.yaoai.domain.entity.TenantMember;
import com.yaoai.domain.entity.User;
import lombok.Data;

import java.time.LocalDateTime;

@Data
public class TeamMemberDTO {

    private Long userId;
    private String username;
    private String email;
    private String avatarUrl;
    private Integer status;
    private String role;
    private String position;
    private LocalDateTime joinedAt;

    public static TeamMemberDTO from(User user, TenantMember member) {
        TeamMemberDTO dto = new TeamMemberDTO();
        dto.setUserId(user.getId());
        dto.setUsername(user.getUsername());
        dto.setEmail(user.getEmail());
        dto.setAvatarUrl(user.getAvatarUrl());
        dto.setStatus(user.getStatus());
        dto.setRole(member.getRole());
        dto.setPosition(member.getPosition());
        dto.setJoinedAt(member.getJoinedAt());
        return dto;
    }
}
