export type ResourceAccessExplanationUser = {
  id: string;
  account_id?: string | null;
  email?: string | null;
  display_name?: string | null;
};

export type AccessDecisionProvenanceItem = {
  kind: string;
  id?: string | null;
  label?: string | null;
  tenant_id?: string | null;
  source?: string | null;
  details?: Record<string, unknown>;
};

export type ResourceAccessExplanationResponse<
  TUser extends ResourceAccessExplanationUser = ResourceAccessExplanationUser,
  TProvenance extends AccessDecisionProvenanceItem = AccessDecisionProvenanceItem
> = {
  user: TUser;
  resource_type: string;
  resource_id: string;
  action: string;
  provenance: TProvenance[];
};

export type ResourceAccessExplanationOptions = {
  userId: string;
  resourceType: string;
  resourceId: string;
  action: string;
  tenantId?: string | null;
};
