package cvt

import (
	ubent "github.com/tidbcloud/devops/entity/userbehavior"
	ubmod "github.com/tidbcloud/devops/models/userbehavior"
)

func (cvt e2m) GTMLead(e *ubent.GTMLead) *ubmod.GTMLead {
	if e == nil {
		return nil
	}
	return &ubmod.GTMLead{
		ID:                  e.ID,
		TenantID:            e.TenantID,
		Email:               e.Email,
		EmailDomain:         e.EmailDomain,
		ContactName:         e.ContactName,
		ContactFirstName:    e.ContactFirstName,
		CompanyName:         e.CompanyName,
		Headquarter:         e.Headquarter,
		Vertical:            e.Vertical,
		BusinessModel:       e.BusinessModel,
		AnnualRevenue:       e.AnnualRevenue,
		FundingSeries:       e.FundingSeries,
		RawEnrichment:       e.RawEnrichment,
		IsQualified:         e.IsQualified,
		QualificationReason: e.QualificationReason,
		MatchedUseCase:      e.MatchedUseCase,
		UseCaseMatchReason:  e.UseCaseMatchReason,
		CreatedAt:           e.CreatedAt,
		UpdatedAt:           e.UpdatedAt,
	}
}

func (cvt m2e) GTMLead(m *ubmod.GTMLead) *ubent.GTMLead {
	if m == nil {
		return nil
	}
	return &ubent.GTMLead{
		ID:                  m.ID,
		TenantID:            m.TenantID,
		Email:               m.Email,
		EmailDomain:         m.EmailDomain,
		ContactName:         m.ContactName,
		ContactFirstName:    m.ContactFirstName,
		CompanyName:         m.CompanyName,
		Headquarter:         m.Headquarter,
		Vertical:            m.Vertical,
		BusinessModel:       m.BusinessModel,
		AnnualRevenue:       m.AnnualRevenue,
		FundingSeries:       m.FundingSeries,
		RawEnrichment:       m.RawEnrichment,
		IsQualified:         m.IsQualified,
		QualificationReason: m.QualificationReason,
		MatchedUseCase:      m.MatchedUseCase,
		UseCaseMatchReason:  m.UseCaseMatchReason,
		CreatedAt:           m.CreatedAt,
		UpdatedAt:           m.UpdatedAt,
	}
}

func (cvt m2e) GTMLeads(ms []ubmod.GTMLead) []*ubent.GTMLead {
	entities := make([]*ubent.GTMLead, len(ms))
	for i, m := range ms {
		entities[i] = cvt.GTMLead(&m)
	}
	return entities
}
