package model

import "encoding/json"

type CorpConfig struct {
	CorpId           string `json:"corpid"`
	Password         string `json:"password"`
	EnterpriseAgent  string `json:"enterprise_agent"`
	EnterpriseSecret string `json:"enterprise_secret"`
	ApproveAgent     string `json:"approve_agent"`
	ApproveSecret    string `json:"approve_secret"`
	PaySecret        string `json:"pay_secret"`
	PayAgent         string `json:"pay_agent"`
	PayMchid         string `json:"pay_mchid"`
	PaySerialNumber  string `json:"pay_serial_number"`
	PayApiKeyV3      string `json:"pay_api_key_v3"`
	PayApiKeyV2      string `json:"pay_api_key_v2"`
	PayCertPem       string `json:"pay_cert_pem"`
	PayKeyPem        string `json:"pay_key_pem"`
	PayChannel       string `json:"pay_channel"`

	TplIdCheckin  string `json:"tplid_checkin"`
	TplIdRefund   string `json:"tplid_refund"`
	TplIdVacation string `json:"tplid_vacation"`
	TplIdPayment  string `json:"tplid_payment"`

	SocialDeduct string `json:"social_deduct"`
	HouseDeduct  string `json:"house_deduct"`
	WorkerHouer  string `json:"worker_houer"`
}

type Corp struct {
	Id         int64
	Name       string
	Host       string
	Config     string
	CreateTime int64
	UpdateTime int64
}

func (c *Corp) GetConfig() *CorpConfig {
	var cfg CorpConfig
	json.Unmarshal([]byte(c.Config), &cfg)

	return &cfg
}