export interface AttachmentData {
  id: number;
  url: string;
  downloadUrl: string;
  caption: string;
  type: string;
  extension: string;
  size: number;
  created_at: string;
  updated_at: string;
}

export interface AttachmentsListResponse {
  data: AttachmentData[];
  links: {
    first: string;
    last: string;
    prev: string;
    next: string;
  };
  meta: {
    current_page: number;
    from: number;
    last_page: number;
    links: Array<{
      url: string;
      label: string;
      active: boolean;
    }>;
    path: string;
    per_page: number;
    to: number;
    total: number;
  };
}

export interface AttachmentResponse {
  data: AttachmentData;
}

export interface CreateAttachmentRequest {
  file: File;
  caption?: string;
}

export interface GetAttachmentsParams {
  entity_type: string;
  entity_id: number;
  caption?: string;
  per_page?: number;
  page?: number;
  sort_direction?: 'asc' | 'desc';
  sort_by?: string;
}

export interface ClientDocumentData {
  name: string;
  id: number;
  type: string;
  subtype: string;
  attachments: AttachmentData[];
  doc_type: string;
  description: string;
  date_created: string;
  location: string;
  upload_as: string;
  extention: string;
  client: {
    id: number;
    salesforce_id: number;
    ssn: number;
    email: string;
    mobile_phone: string;
    joint_customer_sf_id: string;
    client_key: string;
    attributes: {
      Id: string;
      FirstName: string;
      MiddleName: string;
      LastName: string;
      Email: string;
    };
    segments: {
      id: number;
      type: string;
      name: string;
      description: string;
      conditions: {
        combinator: string;
        not: number;
        count_repeat: number;
        relation: string;
        rules: Array<{
          field: string;
          count_repeat: number;
          relation: string;
          operator: string;
          value: string;
        }>;
      };
      is_active: boolean;
      is_archive: boolean;
      clients_count: number;
      negative_items_count: number;
      usage_count: number;
      created_at: string;
      updated_at: string;
    };
  };
  author: {
    id: number;
    first_name: string;
    last_name: string;
    email: string;
    created_at: string;
    updated_at: string;
    user_access_log: {
      last_login_at: string;
    };
    roles: Array<{
      id: string;
      name: string;
      permissions: Array<{
        name: string;
      }>;
    }>;
  };
  created_at: string;
  updated_at: string;
}

export interface ClientDocumentsResponse {
  data: ClientDocumentData[];
}

export interface CreateClientDocumentRequest {
  type: string;
  subtype: string;
  client_id: number;
  attachment_id: number;
}

export interface UpdateClientDocumentRequest {
  attachment_id: number;
  type: string;
  subtype: string;
}
