import { NavigationState } from 'react-navigation';
import { Dispatch } from 'react-redux';
import { Conversation, EmployeeData, EmployerData, Location, MapOfChatRooms, User } from './';
import { Offer } from './offer';

export type Dispatch = Dispatch<RootState>;

export type RootState = {
  user: User;
  navigation: NavigationState;
  offers: Array<Offer>;
  network: NetworkState;
  conversations: Array<Conversation>;
  chats: MapOfChatRooms;
  employeeData: EmployeeData;
  employerData: EmployerData;
};

export type UserUpdateBody = {
  description: string;
  age?: number;
  location: Location;
  name: string;
  photoUrl?: string;
  photoPath?: string;
};

export type Params = {
  loading: boolean;
  error?: string;
};

export type NetworkState = {
  user: {
    auth: Params,
    update: Params,
  },
  offer: {
    new: Params;
    [id: string]: Params;
  },
};

export * from './application';
export * from './location';
export * from './offer';
export * from './user';
export * from './chat';
