Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BudgetStatus ¶ added in v0.7.2
type BudgetStatus struct {
BudgetHours int `json:"budget_hours"`
UsedHours float64 `json:"used_hours"`
Remaining float64 `json:"remaining"`
PercentUsed float64 `json:"percent_used"`
OverBudget bool `json:"over_budget"`
}
BudgetStatus represents the current budget consumption state.
func NewBudgetStatus ¶ added in v0.7.2
func NewBudgetStatus(budgetHours, totalMinutes int) *BudgetStatus
NewBudgetStatus creates a BudgetStatus from budget hours and total consumed minutes.
type CostReport ¶
type CostReport struct {
GeneratedAt time.Time `json:"generated_at"`
Currency string `json:"currency"`
Period string `json:"period,omitempty"`
TaxName string `json:"tax_name,omitempty"`
TaxPercent float64 `json:"tax_percent,omitempty"`
Entries []CostReportEntry `json:"entries"`
TotalHours float64 `json:"total_hours"`
TotalCost float64 `json:"total_cost"`
TotalTax float64 `json:"total_tax"`
TotalWithTax float64 `json:"total_with_tax"`
}
func NewCostReport ¶
func NewCostReport(currency string) *CostReport
func (*CostReport) AddEntry ¶
func (cr *CostReport) AddEntry(entry CostReportEntry, tax *TaxConfig)
func (*CostReport) CSV ¶
func (cr *CostReport) CSV() string
func (*CostReport) SetTax ¶
func (cr *CostReport) SetTax(tax *TaxConfig)
type CostReportEntry ¶
type CostReportEntry struct {
TaskID string `json:"task_id"`
Title string `json:"title"`
RateID string `json:"rate_id"`
RateName string `json:"rate_name"`
Hours float64 `json:"hours"`
HourlyRate float64 `json:"hourly_rate"`
Cost float64 `json:"cost"`
Currency string `json:"currency"`
Description string `json:"description,omitempty"`
Tax float64 `json:"tax,omitempty"`
TotalWithTax float64 `json:"total_with_tax,omitempty"`
}
type Rate ¶
type RateConfig ¶
type RateConfig struct {
Currency string `yaml:"currency" json:"currency"`
Tax *TaxConfig `yaml:"tax,omitempty" json:"tax,omitempty"`
Rates []Rate `yaml:"rates" json:"rates"`
}
func (*RateConfig) AddRate ¶ added in v0.7.2
func (rc *RateConfig) AddRate(rate Rate) error
AddRate adds a rate to the config, enforcing uniqueness and single-default.
func (*RateConfig) GetByID ¶
func (rc *RateConfig) GetByID(id string) *Rate
func (*RateConfig) GetDefault ¶
func (rc *RateConfig) GetDefault() *Rate
func (*RateConfig) RemoveRate ¶ added in v0.7.2
func (rc *RateConfig) RemoveRate(rateID string) error
RemoveRate removes a rate by ID.
func (*RateConfig) SetDefault ¶ added in v0.7.2
func (rc *RateConfig) SetDefault(rateID string) error
SetDefault marks the given rate as default, clearing default from all others.
type Repository ¶ added in v0.7.2
type Repository interface {
SaveRates(config *RateConfig) error
LoadRates() (*RateConfig, error)
SaveTimeEntries(entries []TimeEntry) error
LoadTimeEntries() ([]TimeEntry, error)
}
Repository handles the persistence of billing artifacts. New code should depend on this interface rather than the composed WorkspaceRepository.
type TimeEntry ¶
type TimeEntry struct {
ID string `yaml:"id" json:"id"`
TaskID string `yaml:"task_id" json:"task_id"`
RateID string `yaml:"rate_id" json:"rate_id"`
Minutes int `yaml:"minutes" json:"minutes"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
CreatedAt time.Time `yaml:"created_at" json:"created_at"`
}
Click to show internal directories.
Click to hide internal directories.