package com.yc.ship.module.resource.controller.admin.roommodel.vo;

import com.yc.ship.framework.common.util.collection.CollectionUtils;
import com.yc.ship.module.resource.controller.admin.roommodelservice.vo.ResourceRoomModelServiceRespVO;
import com.yc.ship.module.resource.dal.dataobject.room.ResourceRoomDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.stream.Collectors;

import com.alibaba.excel.annotation.*;
import com.yc.ship.framework.excel.core.annotations.DictFormat;
import com.yc.ship.framework.excel.core.convert.DictConvert;

@Schema(description = "管理后台 - 资源管理-房型管理 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ResourceRoomModelRespVO {

    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14780")
    @ExcelProperty("ID")
    private Long id;

    @Schema(description = "房型名称", example = "王五")
    @ExcelProperty("房型名称")
    private String name;

    @Schema(description = "房型简称")
    @ExcelProperty("房型简称")
    private String shortName;

    @Schema(description = "房型编码")
    @ExcelProperty("房型编码")
    private String code;

    @Schema(description = "所在楼层（多选，逗号分割）")
    @ExcelProperty("所在楼层（多选，逗号分割）")
    private String floorsNum;

    @Schema(description = "所在楼层（多选，逗号分割）")
    @ExcelProperty("所在楼层（多选，逗号分割）")
    private String floorsNumStr;

    @Schema(description = "关联房间")
    @ExcelProperty("关联房间")
    private String roomNums;

    @Schema(description = "所属游轮", example = "1463")
    @ExcelProperty("所属游轮")
    private Long shipId;

    @Schema(description = "所属游轮名称")
    @ExcelProperty("所属游轮名称")
    private String shipName;

    @Schema(description = "卫生间面积（㎡）")
    @ExcelProperty("卫生间面积（㎡）")
    private String bathroomArea;

    @Schema(description = "床位数")
    @ExcelProperty("床位数")
    private Integer bedNum;

    @Schema(description = "阳台面积（㎡）")
    @ExcelProperty("阳台面积（㎡）")
    private String balconyArea;

    @Schema(description = "床尺寸（m）")
    @ExcelProperty("床尺寸（m）")
    private String bedSize;

    @Schema(description = "成本价(元/晚)", example = "1742")
    @ExcelProperty("成本价(元/晚)")
    private BigDecimal price;

    @Schema(description = "是否套房")
    @ExcelProperty(value = "是否套房", converter = DictConvert.class)
    @DictFormat("infra_boolean_string") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private Integer suite;

    @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @ExcelProperty(value = "状态", converter = DictConvert.class)
    @DictFormat("common_status") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private Integer status;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    /**
     * 房型介绍
     */
    @Schema(description = "房型介绍")
    private String introduce;
    /**
     * 房型图片
     */
    @Schema(description = "房型图片")
    private String picUrl;
    /**
     * 房型视频
     */
    @Schema(description = "房型视频")
    private String videoUrl;
    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remark;

    /**
     * 可加床数
     */
    @Schema(description = "可加床数")
    private Integer addBedNum;

    /**
     * 可加成人数（和儿童二选一）
     */
    @Schema(description = "可加成人数（和儿童二选一）")
    private Integer addAdultNum;

    /**
     * 可加儿童数（和成人二选一）
     */
    @Schema(description = "可加儿童数（和成人二选一）")
    private Integer addChildNum;

    /**
     * 可加人数
     */
    @Schema(description = "可加人数,成人和儿童最多可加人数")
    private Integer addNum;

    /**
     * 最大入住人数
     */
    @Schema(description = "最大入住人数")
    private Integer maxNum;

    /**
     * 最大入住成人数
     */
    @Schema(description = "最大入住成人数")
    private Integer maxAdultNum;

    /**
     * 最大入住儿童人数
     */
    @Schema(description = "最大入住儿童人数")
    private Integer maxChildNum;

    @Schema(description = "是否可售")
    private Integer canSale;

    @Schema(description = "房型面积")
    private String roomArea;

    @Schema(description = "房型服务设施")
    private List<ResourceRoomModelServiceRespVO> services;



    public void setFloorsNumStr(String floorsNum) {
        String[] split = floorsNum.split(",");
        this.floorsNumStr = Arrays.stream(split).map(element -> element + "F").collect(Collectors.joining( "，"));
    }

}