package dto

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)

type CooperationContractItem struct {
	CooperationContractId     int    `json:"cooperationContractId,string,"`
	CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
	CooperationProjectNumber  string `json:"cooperationProjectNumber"`  //项目编号
	CooperationContractName   string `json:"CooperationContractName"`   //合约名称
	Status                    int    `json:"status"`                    //合约状态
	CreateTtime               int    `json:"createTtime"`
	Department                struct {
		DepartmentId   int    `json:"departmentId"`
		DepartmentName string `json:"departmentName"`
	} `json:"department"`
	IncentivesType             string `json:"incentivesType"` //Incentives激励方式
	CooperationContractSponsor struct {
		UserId   int    `json:"userId,string,"`
		UserName string `json:"userName"`
	} `json:"cooperationContractSponsor"` //共创发起人
	CooperationMode struct {
		CooperationModeId     int    `json:"cooperationModeId,string,"` // 共创模式ID
		CooperationModeNumber string `json:"cooperationModeNumber"`     // 共创模式编码,
		CooperationModeName   string `json:"cooperationModeName"`       // 模式名称,
	} `json:"cooperationMode"` //共创模式
	Org struct {
		OrgId   int    `json:"orgId"`   // id
		OrgName string `json:"orgName"` //
	} `json:"org"` //组织结构
}

func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract) *CooperationContractItem {
	// relevantPeople := []int{}
	data := CooperationContractItem{
		CooperationContractId:     param.CooperationContractId,
		CooperationProjectNumber:  param.CooperationContractNumber,
		CooperationContractName:   param.CooperationContractName,
		CooperationContractNumber: param.CooperationContractNumber,
		Status:                    param.Status,
		CreateTtime:               int(param.CreatedAt.Unix()),
	}
	data.CooperationContractSponsor.UserId = param.CooperationContractSponsor.UserId
	data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName
	data.Department.DepartmentId = param.Department.DepartmentId
	data.Department.DepartmentName = param.Department.DepartmentName
	data.Org.OrgId = int(param.Org.OrgId)
	data.Org.OrgName = param.Org.OrgName
	data.CooperationMode.CooperationModeId = param.CooperationMode.CooperationModeId
	data.CooperationMode.CooperationModeName = param.CooperationMode.CooperationModeName
	data.CooperationMode.CooperationModeNumber = param.CooperationMode.CooperationModeNumber

	return nil
}

type CooperationContractInfo struct {
}