/* Copyright (C) 2024-2025 LibreWeddingPlanner contributors*/ import { Serializable } from "../api/abstract-api"; import { Entity } from "./definitions"; export const guestStatuses = ['considered', 'invited', 'confirmed', 'declined', 'tentative'] as const; export type GuestStatus = typeof guestStatuses[number]; export class Guest implements Entity { id?: string; name?: string; group_name?: string; groupId?: string; color?: string; status?: GuestStatus; children?: Guest[]; constructor(id?: string, name?: string, group_name?: string, groupId?: string, color?: string, status?: GuestStatus, children?: Guest[]) { this.id = id; this.name = name; this.group_name = group_name; this.groupId = groupId; this.color = color; this.status = status; this.children = children; } } export class GuestSerializer implements Serializable { fromJson(data: any): Guest { return new Guest(data.id, data.name, data.group?.name, data.group?.id, data.color, data.status, data.children); } toJson(guest: Guest): string { return JSON.stringify({ guest: { name: guest.name, status: guest.status, group_id: guest.groupId } }); } apiPath(): string { return 'guests'; } }