package weather

import (
	"context"
	"errors"
)

var ErrNotConfigured = errors.New("weather: not configured")

// ErrLocationUnknown — the geocoder has no such place. A named city that does
// not resolve must read differently from a provider outage: one is "I do not
// know that place", the other is "I could not reach the service", and
// answering for the default location instead is the defect this replaces
// (Vikunja #421).
var ErrLocationUnknown = errors.New("weather: location not found")

type Weather struct {
	Location    string  `json:"location"`
	Temperature float64 `json:"temperature"`
	Condition   string  `json:"condition"`
}

type Provider interface {
	CurrentWeather(ctx context.Context, location string) (Weather, error)
}

type StubProvider struct{}

func NewStubProvider() *StubProvider { return &StubProvider{} }

func (s *StubProvider) CurrentWeather(_ context.Context, location string) (Weather, error) {
	return Weather{}, ErrNotConfigured
}
