package staffsvc

import (
	staffdomain "legalgo-BE-go/internal/domain/staff"
)

func (as *impl) Update(id string, spec staffdomain.StaffUpdate) error {
	if _, err := as.staffRepo.GetStaffByID(id); err != nil {
		return err
	}

	newSpec := staffdomain.Staff{
		ID:             id,
		Email:          spec.Email,
		Name:           spec.Name,
		ProfilePicture: spec.ProfilePicture,
	}

	if err := as.staffRepo.Update(newSpec); err != nil {
		return err
	}

	return nil
}
