package cvt

import (
	tntent "github.com/tidbcloud/devops/entity/tenant"
	"github.com/tidbcloud/devops/models/base"
	tntmod "github.com/tidbcloud/devops/models/tenant"
)

type e2m struct{}

func (cvt e2m) Tenant(e *tntent.Tenant) *tntmod.Tenant {
	return &tntmod.Tenant{
		Updatable: base.Updatable{
			Base: base.Base{ID: base.ID(e.Id), CreatedAt: *e.CreatedAt},
		},
		Name:             e.Name,
		Alias:            e.Alias,
		Email:            e.Email,
		Country:          e.Country,
		CountryRegion:    tntmod.TenantRegion(e.CountryRegion),
		TimeZone:         e.TimeZone,
		Status:           tntmod.TenantStatus(e.Status),
		Kind:             tntmod.TenantKind(e.Kind),
		Plan:             tntmod.TenantPlan(e.Plan),
		CustomID:         e.CustomID,
		Segmentation:     string(e.Segmentation),
		SalesOwnerEmail:  e.SalesOwnerEmail,
		SalesForceRegion: tntmod.TenantRegion(e.SalesForceRegion),
		SalesForceKind:   tntmod.TenantKind(e.SalesForceKind),
		TAMName:          e.TAMName,
	}
}
