import 'package:objectbox/objectbox.dart';

@Entity()
class ChatMessageEntity {
  @Id()
  int id = 0;

  @Unique()
  String messageId;

  @Index()
  String conversationKey;

  String content;

  String contentType; // 'TEXT' or 'IMAGE'

  @Property(type: PropertyType.date)
  @Index()
  DateTime createdAt;

  String origin; // 'INCOMING' or 'OUTGOING'

  String messageType; // 'NORMAL', 'JOB_ASSIGNMENT', etc.

  String? jobId;

  String? jobNumber;

  bool read;

  bool pendingSync;

  ChatMessageEntity({
    required this.messageId,
    required this.conversationKey,
    required this.content,
    this.contentType = 'TEXT',
    required this.createdAt,
    required this.origin,
    required this.messageType,
    this.jobId,
    this.jobNumber,
    this.read = false,
    this.pendingSync = false,
  });
}

