import Foundation

struct SessionResponse: Codable {
    let token: String
    let user: User
}

struct MeResponse: Codable {
    let user: User
}

struct DiscoverResponse: Codable {
    let profiles: [User]
}

struct MatchesResponse: Codable {
    let matches: [MatchSummary]
}

struct ChatsResponse: Codable {
    let chats: [ChatSummary]
}

struct MessagesResponse: Codable {
    let messages: [ChatMessage]
}

struct SwipeResponse: Codable {
    let didMatch: Bool
    let match: MatchSummary?
}

struct MessageEnvelope: Codable {
    let message: ChatMessage
}

struct User: Codable, Identifiable, Hashable {
    let id: Int
    let name: String
    let email: String
    let age: Int
    let bio: String
    let city: String
    let occupation: String
    let gender: String
    let interestedIn: String
    let prompt: String
    let interests: [String]
    let photos: [String]
    let distanceKm: Int
}

struct MatchSummary: Codable, Identifiable, Hashable {
    let id: Int
    let matchedAt: String
    let user: User
    let lastMessage: String?
}

struct ChatSummary: Codable, Identifiable, Hashable {
    let id: Int
    let matchId: Int
    let otherUser: User
    let lastMessage: ChatMessage?
}

struct ChatMessage: Codable, Identifiable, Hashable {
    let id: Int
    let matchId: Int
    let senderId: Int
    let text: String
    let createdAt: String
}

enum SwipeDirection: String, Codable {
    case like
    case pass
}
