<?php

namespace app\entity\data\shipping;

use app\entity\data\DataEntity;

class ShippingTemplateFreeEntity extends DataEntity
{
    public $shippingTemplateFreeId = 0;  // 编号
    public $tempId = 0;  // 模板ID
    public $cityId = '';  // 城市ID /id/id/id/id/
    public $cityIdList = [];  // 城市ID []
    public $number = 0;  // 包邮件数
    public $price = 0.00;  // 包邮金额

    /**
     * @return int
     */
    public function getShippingTemplateFreeId(): int
    {
        return $this->shippingTemplateFreeId;
    }

    /**
     * @param int $shippingTemplateFreeId
     * @return ShippingTemplateFreeEntity
     */
    public function setShippingTemplateFreeId(int $shippingTemplateFreeId): ShippingTemplateFreeEntity
    {
        $this->shippingTemplateFreeId = $shippingTemplateFreeId;
        return $this;
    }

    /**
     * @return int
     */
    public function getTempId(): int
    {
        return $this->tempId;
    }

    /**
     * @param int $tempId
     * @return ShippingTemplateFreeEntity
     */
    public function setTempId(int $tempId): ShippingTemplateFreeEntity
    {
        $this->tempId = $tempId;
        return $this;
    }

    /**
     * @return string
     */
    public function getCityId(): string
    {
        return $this->cityId;
    }

    /**
     * @param string $cityId
     * @return ShippingTemplateFreeEntity
     */
    public function setCityId(string $cityId): ShippingTemplateFreeEntity
    {
        $this->cityId = $cityId;
        $cityIdList = explode("/", $this->cityId);
        $cityIdList = array_filter($cityIdList); // 删除空元素
        $cityIdList = array_values($cityIdList); // 重建数组索引
        $this->setCityIdList($cityIdList);
        return $this;
    }

    /**
     * @return array
     */
    public function getCityIdList(): array
    {
        return $this->cityIdList;
    }

    /**
     * @param array $cityIdList
     * @return ShippingTemplateFreeEntity
     */
    public function setCityIdList(array $cityIdList): ShippingTemplateFreeEntity
    {
        $this->cityIdList = $cityIdList;
        return $this;
    }

    /**
     * @return int
     */
    public function getNumber(): int
    {
        return $this->number;
    }

    /**
     * @param int $number
     * @return ShippingTemplateFreeEntity
     */
    public function setNumber(int $number): ShippingTemplateFreeEntity
    {
        $this->number = $number;
        return $this;
    }

    /**
     * @return float
     */
    public function getPrice(): float
    {
        return $this->price;
    }

    /**
     * @param float $price
     * @return ShippingTemplateFreeEntity
     */
    public function setPrice(float $price): ShippingTemplateFreeEntity
    {
        $this->price = $price;
        return $this;
    }
}
