import axiosInstance from 'api/axios';
import { BRANCH_LIST } from 'api/URL';

export interface Branch {
  address: string | null;
  code: string;
  id: number;
  latitude: number;
  longitude: number;
  name: string;
  phone: string;
  telegramAdmin: string;
  telegramChannel: string;
  workingHours: string;
}

const branch = {
  async branchList(): Promise<Branch[]> {
    try {
      const response = await axiosInstance.get<Branch[]>(BRANCH_LIST);
      return response.data;
    } catch (error) {
      return [];
    }
  },
};

export const branchApi = branch;
