<?php

namespace App\Http\Requests\Site;

use App\Http\Requests\Request;

class CustomerRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        if ($this->method() == 'GET') {
            return [];
        }

        switch ($this->input('act')) {
            case 'addition':
                return [
                    'addition.domain_type' => 'required',
                    'addition.new_domain' => 'nullable',
                    'addition.old_domain' => 'nullable',
                    'addition.old_account' => 'nullable',
                    'addition.old_password' => 'nullable',
                    'addition.old_url' => 'nullable',
                    'addition.old_expired' => 'nullable',
                    'addition.site_url' => 'nullable',
                    'addition.site_account' => 'nullable',
                    'addition.site_password' => 'nullable',
                    'addition.ftp_account' => 'nullable',
                    'addition.ftp_domain' => 'nullable',
                    'addition.ftp_password' => 'nullable',
                    'addition.ftp_port' => 'nullable',
                    'addition.ftp_ip' => 'nullable'
                ];
            case 'keyword':
                return [
                    'keyword' => 'nullable|array'
                ];
            case 'station':
                return [
                    'station.other_sites' => 'nullable|array',
                    'station.portal_sites' => 'nullable|array',
                    'station.compete_sites' => 'nullable|array'
                ];

            case 'enterprise':
                return [
                    'enterprise.export_region' => 'nullable',
                    'enterprise.business_id' => 'nullable',
                    'enterprise.nature_type' => 'nullable',
                    'enterprise.company_nature' => 'nullable',
                    'enterprise.company_size' => 'nullable',
                    'enterprise.customer_scope' => 'nullable',
                    'enterprise.brand' => 'nullable',
                    'enterprise.cn_title' => 'nullable',
                    'enterprise.cn_profile' => 'nullable',
                    'enterprise.cn_address' => 'nullable',
                    'enterprise.en_slogan' => 'nullable',
                    'enterprise.en_title' => 'nullable',
                    'enterprise.en_profile' => 'nullable',
                    'enterprise.en_address' => 'nullable',
                    'enterprise.setup_time' => 'nullable',
                    'enterprise.postcode' => 'nullable',
                    'enterprise.line_phone' => 'nullable',
                    'enterprise.fax' => 'nullable',
                    'enterprise.email' => 'nullable',
                    'enterprise.deliver_period' => 'nullable',
                    'enterprise.supply' => 'nullable',
                    'enterprise.min_supply' => 'nullable',
                    'enterprise.price_range' => 'nullable',
                    'enterprise.packing_way' => 'nullable',
                    'enterprise.pay_way' => 'nullable',
                    'enterprise.skype' => 'nullable',
                    'enterprise.whats_app' => 'nullable',
                    'enterprise.wechat' => 'nullable',
                    'enterprise.qq' => 'nullable',
                    'enterprise.other' => 'nullable'
                ];
            case 'marketer':
                return [
                    'marketer.en_name' => 'nullable',
                    'marketer.en_profile' => 'nullable',
                    'marketer.sex_text' => 'nullable',
                    'marketer.birthday' => 'nullable',
                    'marketer.position' => 'nullable',
                    'marketer.department' => 'nullable',
                    'marketer.contact' => 'nullable',
                    'marketer.enterprise_email' => 'nullable',
                    'marketer.enterprise_login_url' => 'nullable',
                    'marketer.enterprise_email_password' => 'nullable',
                    'marketer.gmail_account' => 'nullable',
                    'marketer.gmail_password' => 'nullable',
                    'marketer.gmail_contact' => 'nullable',
                    'marketer.gmail_assist' => 'nullable',
                ];
            case 'sns':
                return [
                    'sns.youtube_url' => 'nullable',
                    'sns.youtube_account' => 'nullable',
                    'sns.youtube_password' => 'nullable',

                    'sns.facebook_my_url' => 'nullable',
                    'sns.facebook_url' => 'nullable',
                    'sns.facebook_account' => 'nullable',
                    'sns.facebook_password' => 'nullable',

                    'sns.twitter_url' => 'nullable',
                    'sns.twitter_account' => 'nullable',
                    'sns.twitter_password' => 'nullable',

                    'sns.linkedin_my_url' => 'nullable',
                    'sns.linkedin_url' => 'nullable',
                    'sns.linkedin_account' => 'nullable',
                    'sns.linkedin_password' => 'nullable',

                    'sns.pinterst_url' => 'nullable',
                    'sns.pinterst_account' => 'nullable',
                    'sns.pinterst_password' => 'nullable'
                ];
            default:
                return [];
        }
    }


    public function messages()
    {
        $all = parent::messages();
        $all['required_if'] = ':attribute 不能为空';
        return $all;
    }

    public function attributes()
    {

        return [
            'addition.domain_type' => '是否新域名注册',
            'addition.new_domain' => '新域名',
            'addition.old_domain' => '旧域名',
            'addition.old_account' => '旧域名登录账号',
            'addition.old_password' => '旧域名密码',
            'addition.old_url' => '旧域名注册网址',
            'addition.old_expired' => '旧域名到期时间',
            'addition.site_url' => '网站后台地址',
            'addition.site_account' => '网站后台用户名',
            'addition.site_password' => '网站后台密码',
            'addition.ftp_account' => 'ftp账号',
            'addition.ftp_domain' => 'ftp域名',
            'addition.ftp_password' => 'ftp密码',
            'addition.ftp_port' => 'fpt端口号',
            'addition.ftp_ip' => 'ftp ip地址',

            'keyword.keyword' => '关键词',

            'station.other_sites' => '公司其他网站',
            'station.portal_sites' => '行业门户网站',
            'station.compete_sites' => '竞争对手网站',


            'enterprise.export_region' => '主要出口国家或市场',
            'enterprise.business' => '所属行业',
            'enterprise.company_type' => '公司类型',
            'enterprise.customer_scope' => '客户群体*',
            'enterprise.brand' => '品牌',
            'enterprise.cn_title' => '公司名称(中文)',
            'enterprise.cn_profile' => '公司简介(中文)*',
            'enterprise.cn_address' => '公司地址(中文)',
            'enterprise.en_title' => '公司名称(英文)',
            'enterprise.en_profile' => '公司简介(英文)',
            'enterprise.en_address' => '公司地址(英文)',
            'enterprise.setup_time' => '公司成立时间*',
            'enterprise.postcode' => '邮编',
            'enterprise.line_phone' => '公司座机',
            'enterprise.fax' => '公司传真',
            'enterprise.email' => '公司邮箱',
            'enterprise.deliver_period' => '发货期',
            'enterprise.supply' => '供应量',
            'enterprise.min_supply' => '最低供应量',
            'enterprise.price_range' => '价格区间',
            'enterprise.packing_way' => '包装方式',
            'enterprise.pay_way' => '支付方式',
            'enterprise.skype' => 'Skype账号',
            'enterprise.whats_app' => 'Whatsapp手机号',
            'enterprise.wechat' => 'Wechat 二维码',
            'enterprise.qq' => 'QQ',
            'enterprise.other' => '其他',


            'marketer.en_name' => '联系人英文姓名',
            'marketer.en_profile' => '联系人简介',
            'marketer.sex_text' => '联系人性别',
            'marketer.birthday' => '联系人出生年月',
            'marketer.position' => '联系人职位',
            'marketer.department' => '联系人部门',
            'marketer.contact' => '联系人电话',
            'marketer.enterprise_email' => '企业邮箱',
            'marketer.enterprise_login_url' => '企业邮箱登录地址',
            'marketer.enterprise_email_password' => '企业邮箱密码',
            'marketer.gmail_account' => 'Gmail邮箱',
            'marketer.gmail_password' => 'Gmail*密码',
            'marketer.gmail_contact' => 'Gmail验证手机号码',
            'marketer.gmail_assist' => 'Gmail辅助邮箱',


            'sns.youtube_url' => 'youtube展示url地址',
            'sns.youtube_account' => 'youtube登入邮箱',
            'sns.youtube_password' => 'youtube密码',
            'sns.facebook_url' => 'facebook展示url地址',
            'sns.facebook_account' => 'facebook登入邮箱',
            'sns.facebook_password' => 'facebook密码',
            'sns.twitter_url' => 'twitter展示url地址',
            'sns.twitter_account' => 'twitter登入邮箱',
            'sns.twitter_password' => 'twitter密码',
            'sns.linkedin_url' => 'linkedin展示url地址',
            'sns.linkedin_account' => 'linkedin登入邮箱',
            'sns.linkedin_password' => 'linkedin密码',
            'sns.pinterst_url' => 'pinterst展示url地址',
            'sns.pinterst_account' => 'pinterst登入邮箱',
            'sns.pinterst_password' => 'pinterst密码'

        ];

    }
}