package main

import "time"

type buoy struct {
	ID        string    `db:"id" json:"id"`
	Name      string    `db:"name" json:"name"`
	Latitude  float64   `db:"latitude" json:"latitude"`
	Longitude float64   `db:"longitude" json:"longitude"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
}

type reading struct {
	ID         string    `db:"id" json:"id"`
	BuoyID     string    `db:"buoy_id" json:"buoy_id"`
	WaterTemp  float64   `db:"water_temp" json:"water_temp"`
	WaveHeight float64   `db:"wave_height" json:"wave_height"`
	Salinity   *float64  `db:"salinity" json:"salinity,omitempty"`
	RecordedAt time.Time `db:"recorded_at" json:"recorded_at"`
}

type aggregate struct {
	Bucket        time.Time `db:"bucket" json:"bucket"`
	AverageTemp   float64   `db:"average_water_temp" json:"average_water_temp"`
	AverageWave   float64   `db:"average_wave_height" json:"average_wave_height"`
	AverageSaline *float64  `db:"average_salinity" json:"average_salinity"`
	Count         int64     `db:"count" json:"count"`
}
