package link

import (
	"fmt"
	"net/url"
)

type service struct {
	host string
}

func NewLinkService(host string) ILinkService {
	return &service{
		host: host,
	}
}

func (s *service) GetTeamClientLink(name string, password string) string {
	return fmt.Sprintf("%s?name=%s&password=%s", s.host, url.PathEscape(name), password)
}

func (s *service) GetImageLink(name string) string {
	if len(name) == 0 {
		return ""
	}
	return fmt.Sprintf("%s/%s", s.host, name)
}
