import { ArticleModel, AuthorModel } from "./models";

export interface ArticleContextModel {
  articles: ArticleModel[];
  loading: boolean;
  error: string | null;
  refreshArticles: () => Promise<void>;
  updateArticle: (user: ArticleModel) => Promise<ArticleModel | void>;
  createArticle: (user: ArticleModel) => Promise<ArticleModel | void>;
}

export interface AuthContextModel {
  currentUser: AuthorModel | null;
  authors: AuthorModel[];
  token: string | null;
  loading: boolean;
  error: string | null;
  login: (username: string, password: string) => Promise<void>;
  register: (username: string, password: string) => Promise<void>;
  logout: () => void;
  refreshAuthors: () => Promise<void>;
  updateProfile: (user: AuthorModel) => Promise<AuthorModel | void>;
}

export interface UploadContextModel {
  uploadFile: (file: File) => Promise<string | null>;
  uploading: boolean;
  error: string | null;
}
