interface CWReference {
  id: number;
  name: string;
  _info?: Record<string, string>;
}

interface CWMemberReference {
  id: number;
  identifier: string;
  name: string;
  _info?: Record<string, string>;
}

interface CWCompanyReference {
  id: number;
  identifier: string;
  name: string;
  _info?: Record<string, string>;
}

interface CWContactReference {
  id: number;
  name: string;
  _info?: Record<string, string>;
}

export interface CWActivity {
  id: number;
  name: string;
  type: CWReference;
  company: CWCompanyReference;
  contact: CWContactReference;
  phoneNumber: string;
  email: string;
  status: CWReference;
  opportunity: CWReference;
  ticket: CWReference;
  agreement: CWReference;
  campaign: CWReference;
  notes: string;
  dateStart: string;
  dateEnd: string;
  assignTo: CWMemberReference;
  scheduleStatus: CWReference;
  reminder: CWReference;
  where: CWReference;
  notifyFlag: boolean;
  mobileGuid: string;
  currency: CWReference;
  customFields: CWActivityCustomField[];
  _info: CWActivityInfo;
}

export interface CWActivityCustomField {
  id: number;
  caption: string;
  type: string;
  entryMethod: string;
  numberOfDecimals: number;
  value: unknown;
}

export interface CWActivityInfo {
  lastUpdated: string;
  updatedBy: string;
  dateEntered: string;
  enteredBy: string;
}

export interface CWActivitySummary {
  id: number;
  _info?: Record<string, string>;
}

export interface CWCreateActivity {
  name: string;
  type?: { id: number };
  company?: { id: number };
  contact?: { id: number };
  phoneNumber?: string;
  email?: string;
  status?: { id: number };
  opportunity?: { id: number };
  ticket?: { id: number };
  agreement?: { id: number };
  campaign?: { id: number };
  notes?: string;
  dateStart?: string;
  dateEnd?: string;
  assignTo?: { id: number };
  scheduleStatus?: { id: number };
  reminder?: { id: number };
  where?: { id: number };
  notifyFlag?: boolean;
}

export interface CWUpdateActivity {
  name?: string;
  type?: { id: number };
  company?: { id: number };
  contact?: { id: number };
  phoneNumber?: string;
  email?: string;
  status?: { id: number };
  opportunity?: { id: number };
  ticket?: { id: number };
  agreement?: { id: number };
  campaign?: { id: number };
  notes?: string;
  dateStart?: string;
  dateEnd?: string;
  assignTo?: { id: number };
  scheduleStatus?: { id: number };
  reminder?: { id: number };
  where?: { id: number };
  notifyFlag?: boolean;
}

export interface CWPatchOperation {
  op: "replace" | "add" | "remove";
  path: string;
  value: unknown;
}
