package transform

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg/models"
)

func TransformToUserDomainModelFromPgModels(userModel *models.User) (*domain.User, error) {
	return &domain.User{
		UserId:         userModel.UserId,
		CompanyId:      userModel.CompanyId,
		UserBaseId:     userModel.UserBaseId,
		UserType:       userModel.UserType,
		UserCode:       userModel.UserCode,
		OrganizationId: userModel.OrganizationId,
		DepartmentId:   userModel.DepartmentId,
		//UserInfo:       userModel.UserInfo,
		UserOrg:         userModel.UserOrg,
		UserRole:        userModel.UserRole,
		FavoriteMenus:   userModel.FavoriteMenus,
		CooperationInfo: userModel.CooperationInfo,
		EnableStatus:    userModel.EnableStatus,
		Ext:             userModel.Ext,
		CreatedAt:       userModel.CreatedAt,
		UpdatedAt:       userModel.UpdatedAt,
		Department: &domain.Department{
			DepartmentId:   userModel.DepartmentId,
			DepartmentName: userModel.Ext.DepName,
		},
		Organization: &domain.Org{
			OrgId:   userModel.OrganizationId,
			OrgName: userModel.Ext.OrgName,
		},
	}, nil
}