package dpho

import (
	"context"
	"service/pkg/errors"
)

type Service interface {
	GetDPHO(ctx context.Context) ([]DPHOData, error)
}

type service struct {
	repo Repository
}

func NewService(repo Repository) Service {
	return &service{repo: repo}
}

func (s *service) GetDPHO(ctx context.Context) ([]DPHOData, error) {
	res, err := s.repo.GetDPHO(ctx)
	if err != nil {
		return nil, errors.ExternalError().Message("Gagal mengambil referensi DPHO Apotek BPJS").Cause(err).Build()
	}
	return res, nil
}
