package convert

import (
	hat_pull_model "code.gitlink.org.cn/Gitlink/gitea_hat.git/models/pull"
	hat_api "code.gitlink.org.cn/Gitlink/gitea_hat.git/modules/structs"
)

func ToAPIPullRequestVersion(prv *hat_pull_model.PullRequestVersion) *hat_api.PullRequestVersion {
	apiPullRequestVersion := &hat_api.PullRequestVersion{
		ID:             prv.ID,
		AddLineNum:     prv.AddLineNum,
		DelLineNum:     prv.DelLineNum,
		CommitsCount:   prv.CommitsCount,
		FilesCount:     prv.FilesCount,
		HeadCommitSha:  prv.HeadCommitID,
		BaseCommitSha:  prv.BaseCommitID,
		StartCommitSha: prv.StartCommitID,
		CreatedAt:      prv.CreatedUnix.AsTimePtr(),
		UpdatedAt:      prv.UpdatedUnix.AsTimePtr(),
	}

	return apiPullRequestVersion
}
