<?php

namespace App\Http\Controllers\Channel\OfficialAccount\Transformers;

class OfficialAccountTransformer
{
    public function transform($officialAccount)
    {
        return [
            'id' => $officialAccount->id,
            'name' => $officialAccount->name,
            'nickname' => $officialAccount->nickname,
            'alias' => $officialAccount->alias,
            'head_img' => $officialAccount->head_img,
            'appid' => $officialAccount->appid,
            'appsecret' => $officialAccount->appsecret,
            'verify_txt' => $officialAccount->verify_txt,
            'is_auth' => $officialAccount->is_auth,
            'service_type_info' => $officialAccount->service_type_info,
            'subscribe_top_num' => $officialAccount->subscribe_top_num,
            'subscribe_day_maximum' => $officialAccount->subscribe_day_maximum,
            'distribution_channel_id' => $officialAccount->distribution_channel_id,
            'qrcode_url' => $officialAccount->qrcode_url,
            'principal_name' => $officialAccount->principal_name,
            'func_info' => $officialAccount->func_info,
            'authorizer_refresh_token' => $officialAccount->authorizer_refresh_token,
            'cancel_auth_time' => $officialAccount->cancel_auth_time,
            'official_account_type' => $officialAccount->official_account_type,
            'verify_type_info' => $officialAccount->verify_type_info,
            'is_enabled' => $officialAccount->is_enabled,
            'todayForceSubscribeUsers' => $officialAccount->todayForceSubscribeUsers,
            'allForceSubscribeUsers' => $officialAccount->allForceSubscribeUsers,
            'sort_no' => isset($officialAccount->sort_no)?$officialAccount->sort_no:'0',
            //'subscribe_top_num' => $officialAccount->subscribe_top_num,
            //'subscribe_day_maximum' => $officialAccount->subscribe_day_maximum,
            'force_subscribe_type' => isset($officialAccount->force_subscribe_type) ? $officialAccount->force_subscribe_type : 1,
            'resource_url' => isset($officialAccount->resource_url) ? $officialAccount->resource_url : '',
            'force_subscribe_type_text'=>isset($officialAccount->force_subscribe_type_text)?$officialAccount->force_subscribe_type_text:''
        ];
    }
}