// Code generated by fkit v3.11.0. DO NOT EDIT. // // Source: schema/payroll // Regenerate with: go run ./tools/fkitgen ./schema/payroll package payroll import "time" // PayslipDTO is the generated wire representation of a payslip row. type PayslipDTO struct { ID string `json:"id"` CycleID string `json:"cycleId"` EmployeeID string `json:"employeeId"` Currency string `json:"currency"` PeriodFrom time.Time `json:"periodFrom"` PeriodTo time.Time `json:"periodTo"` GrossCents int64 `json:"grossCents"` DeductionCents int64 `json:"deductionCents"` NetCents int64 `json:"netCents"` } // PayrollCycleDTO is the generated wire representation of a payroll_cycle row. type PayrollCycleDTO struct { ID string `json:"id"` Start time.Time `json:"start"` End time.Time `json:"end"` Status string `json:"status"` } // PayslipListDTO is the generated list envelope for payslip rows. type PayslipListDTO struct { Items []PayslipDTO `json:"items"` NextCursor string `json:"nextCursor,omitempty"` Total int64 `json:"total"` } // PayslipToDTO converts a payslip row to its wire form. func PayslipToDTO(r PayslipRow) PayslipDTO { return PayslipDTO{ ID: r.ID, CycleID: r.CycleID, EmployeeID: r.EmployeeID, Currency: r.Currency, PeriodFrom: r.PeriodFrom, PeriodTo: r.PeriodTo, GrossCents: r.GrossCents, DeductionCents: r.DeductionCents, NetCents: r.NetCents, } } // PayslipFromDTO converts a wire payslip back to a row. func PayslipFromDTO(d PayslipDTO) PayslipRow { return PayslipRow{ ID: d.ID, CycleID: d.CycleID, EmployeeID: d.EmployeeID, Currency: d.Currency, PeriodFrom: d.PeriodFrom, PeriodTo: d.PeriodTo, GrossCents: d.GrossCents, DeductionCents: d.DeductionCents, NetCents: d.NetCents, } } // PayrollCycleToDTO converts a payroll_cycle row to its wire form. func PayrollCycleToDTO(r PayrollCycleRow) PayrollCycleDTO { return PayrollCycleDTO{ID: r.ID, Start: r.Start, End: r.End, Status: r.Status} } // PayslipsToListDTO wraps payslip rows in the generated list envelope. func PayslipsToListDTO(rows []PayslipRow, total int64) PayslipListDTO { items := make([]PayslipDTO, 0, len(rows)) for _, r := range rows { items = append(items, PayslipToDTO(r)) } return PayslipListDTO{Items: items, Total: total} }