<?php

namespace App\Services\Pair\DataModels;

class PairMatchDataSource
{
    /** @var int 用户id */
    public $uid;

    /** @var int 报名id */
    public $pairId;

    /** @var int 用户身高 */
    public $height;

    /** @var \DateTime 出生日期 */
    public $birthDate;

    /** @var int 匹配最小年龄 */
    public $matchMinAge;

    /** @var int 匹配最大年龄 */
    public $matchMaxAge;

    /** @var int 匹配半径 */
    public $matchRadius;

    /** @var float 报名定位经度 */
    public $enrollLongitude;

    /** @var float 报名定位纬度 */
    public $enrollLatitude;

    /** @var int 性别1男2女 */
    public $gender;

    /** @var int 性取向1男2女 */
    public $sexualOrientation;

    /** @var array 范围内的用户数组 */
    public $rangeUsers = array();

    public function __construct(array $data)
    {
        array_key_exists('uid', $data) && $this->uid = $data['uid'];
        array_key_exists('height', $data) && $this->height = $data['height'];

        array_key_exists('id', $data) && $this->pairId = $data['id'];

        array_key_exists('age', $data) && $this->birthDate = $data['age'];
        array_key_exists('match_min_age', $data) && $this->matchMinAge = $data['match_min_age'];
        array_key_exists('match_max_age', $data) && $this->matchMaxAge = $data['match_max_age'];

        array_key_exists('match_raduis', $data) && $this->matchRadius = $data['match_raduis'];
        array_key_exists('lng', $data) && $this->enrollLongitude = $data['lng'];
        array_key_exists('lat', $data) && $this->enrollLatitude = $data['lat'];

        array_key_exists('sxo', $data) && $this->sexualOrientation = $data['sxo'];
        array_key_exists('sex', $data) && $this->gender = $data['sex'];
    }
}
