import { request } from './request'

export function getDashboard(params = {}) {
	return request.get('/smoke/dashboard', params)
}

export function getNextSmokeTime(params = {}) {
	return request.get('/smoke/next_smoke_time', params)
}

export function getLogs(params = {}) {
	return request.get('/smoke/logs', params)
}

export function getLatestLogs(limit = 20) {
	return request.get('/smoke/logs/latest', { limit })
}

export function getLog(id) {
	return request.get(`/smoke/logs/${id}`)
}

export function createLog(data) {
	return request.post('/smoke/logs', data)
}

export function updateLog(id, data) {
	return request.put(`/smoke/logs/${id}`, data)
}

export function deleteLog(id) {
	return request.delete(`/smoke/logs/${id}`)
}

export function createResistedLog(data) {
	return request.post('/smoke/logs/resisted', data)
}

export function getAiAdvice(date) {
	return request.get('/smoke/ai/advice', { date })
}

export function unlockAiAdvice(data) {
	return request.post('/smoke/ai/advice_unlocks', data)
}
