package dto import ( "mtusi2026-messenger/internal/model" "strings" "time" "unicode/utf8" "github.com/google/uuid" ) type CreateChatRequest struct { Title string `json:"title"` MemberIDs []uuid.UUID `json:"member_ids"` } type ChatResponse struct { ID uuid.UUID `json:"id"` Title string `json:"title"` MemberIDs []uuid.UUID `json:"member_ids"` CreatedAt time.Time `json:"created_at"` } type ChatPageResponse struct { Items []ChatResponse `json:"items"` NextCursor *string `json:"next_cursor"` } func (r CreateChatRequest) Validate() bool { titleLen := utf8.RuneCountInString(r.Title) if strings.TrimSpace(r.Title) == "" || titleLen > 100 { return false } if len(r.MemberIDs) < 1 || len(r.MemberIDs) > 100 { return false } return true } func ToChatResponse(c model.Chat) ChatResponse { return ChatResponse{ ID: c.ID, Title: c.Title, MemberIDs: c.MemberIDs, CreatedAt: c.CreatedAt, } }