package config

import (
	"context"
	"time"
)

type Provider interface {
	GetValue(ctx context.Context, key Key) Value
}

type Key string

type Value interface {
	Int() int
	String() string
	Float() float64
	Duration() time.Duration
}

type DurationValue time.Duration

type FloatValue struct {
	EmptyValue
	Val float64
}

func (v FloatValue) Float() float64 {
	return v.Val
}

type StringValue struct {
	EmptyValue
	Val string
}

func (v StringValue) String() string {
	return v.Val
}

type IntValue struct {
	EmptyValue
	Val int
}

func (v IntValue) Int() int {
	return v.Val
}

func (v IntValue) Float() float64 {
	return float64(v.Val)
}

type EmptyValue struct{}

func (v EmptyValue) Int() int {
	return 0
}

func (v EmptyValue) String() string {
	return ""
}

func (v EmptyValue) Float() float64 {
	return 0
}

func (v EmptyValue) Duration() time.Duration {
	return 0
}
