import type { Errand, NewErrand } from '../schema.js';

export type ErrandStatus = 'active' | 'pending_review' | 'conflict' | 'merged' | 'abandoned';
export type ErrandWithAlias = Errand & { agentAlias: string | null };

export type CreateErrandData = Omit<NewErrand, 'createdAt' | 'updatedAt'>;
export type UpdateErrandData = Partial<Omit<NewErrand, 'id' | 'createdAt'>>;

export interface ErrandRepository {
  create(data: CreateErrandData): Promise<Errand>;
  findById(id: string): Promise<ErrandWithAlias | undefined>;
  findAll(opts?: { projectId?: string; status?: ErrandStatus }): Promise<ErrandWithAlias[]>;
  update(id: string, data: UpdateErrandData): Promise<Errand>;
  delete(id: string): Promise<void>;
}
