package antrol

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

type Service interface {
	GetRefPoli(ctx context.Context) ([]Poli, error)
}

type service struct {
	repo Repository
}

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

func (s *service) GetRefPoli(ctx context.Context) ([]Poli, error) {
	res, err := s.repo.GetRefPoli(ctx)
	if err != nil {
		return nil, errors.ExternalError().Message("Gagal mengambil referensi poli Antrean RS BPJS").Cause(err).Build()
	}
	return res, nil
}
