import axios from "axios";
import BaseServices from "../Base/BaseServices";

class AveriaService {
    constructor() {
        BaseServices.getBaseUrl()
        this.AVERIA_PATH = "/api/collections/averias/records"
    }
    averiaCreate(input) {
        let data = {
            name: input.name,
            email: input.email,
            storecode: input.storecode,
            country:input.country
        }
        return axios.post(this.AVERIA_PATH,data)
    }
    getAllAverias() {
        return axios.get(this.AVERIA_PATH)
    }
    deleteAveria(id) {
        return axios.delete(`${this.AVERIA_PATH}/${id}`)
    }
    getAveriaById(id) {
        return axios.get(`${this.AVERIA_PATH}/${id}`)
    }
    update(input,id) {
        let data = {
            name: input.name,
            email: input.email,
            storecode: input.storecode,
            country:input.country
        }
        return axios.patch(`${this.AVERIA_PATH}/${id}`,data)
    }
}

export default AveriaService = new AveriaService()