package com.yonge.cooleshow.admin.io.request;

import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Pattern;

/**
 * 机构表
 * 2023-08-01 11:19:12
 */
@ApiModel(value = "TenantInfoVo对象", description = "机构表查询视图对象")
public class TenantInfoVo {

    @Data
    @ApiModel(" TenantInfo-机构表")
    public static class TenantInfo {

        @ApiModelProperty("主键ID")
        private Long id;

        @ApiModelProperty("名称")
        private String name;

        @ApiModelProperty("logo")
        private String logo;

        @ApiModelProperty("简介")
        private String briefIntroduction;

        @ApiModelProperty("省份编码")
        private Integer provinceCode;

        @ApiModelProperty("城市编码")
        private Integer cityCode;

        @ApiModelProperty("地区/街道")
        private Integer regionCode;

        @ApiModelProperty("联系人")
        @Length(min = 1, max = 8, message = "联系人字符最大8位")
        private String username;

        @ApiModelProperty("手机号")
        @Pattern(regexp = "^1\\d{10}$", message = "手机号码格式错误")
        private String phone;

        public String jsonString() {
            return JSON.toJSONString(this);
        }

        public static TenantInfo from(String json) {
            return JSON.parseObject(json, TenantInfo.class);
        }
    }

}