import {Module} from 'vuex'
import {RootState} from '../index'

interface DesignDetail{
    workspace:any,
    workspaceSex:any,
    workspacePosition:any,
	workspaceAllPosition:any,//所有位置
	probjects:any,//项目参数
	projectList:any,//项目列表参数
}

const Workspace : Module<DesignDetail,RootState> = {
    state:{
        workspace:{},
		workspaceSex:{},
		workspacePosition:{},
		workspaceAllPosition:{},
		probjects:{
			name:'',//项目名称
			id:'',//项目id
			type:'',//项目类型
			httpType:'',//项目类型
			styleName:'',//项目风格
			style:'',
			styleId:null,//项目风格
			sex:'Female',//项目性别
			ageGroup:'Adult',//年龄组
			positionList:[],//衣服位置
			position:{},//衣服位置
			publishData:{
				id:'',
				portfolioDes:'',
				portfolioName:'',
				tagsDTO:[],
			},//发布的作品数据
			systemDesignerPercentage:30,//设计师分成
			model:{
				id:null,
				url:'',
				type:'',
			},//模特
		},
		projectList:[],//项目列表参数
    },
    mutations:{
        setWorkspace(state,files){
            state.workspace = files
			//写一个下载视频的代码
			// const a = document.createElement('a')
			// a.href = files
			// a.download = 'video.mp4'
			// a.click()
        },
		setWorkspaceSex(state,files){
            state.workspaceSex = files
        },
		setWorkspacePosition(state,files){
            state.workspacePosition = files
        },
		setWorkspaceAllPosition(state,files){
            state.workspaceAllPosition = files
        },
		setProjectList(state,list){
            state.projectList = list
        },
		setProbject(state,data){
			for (const key in data) {
				if(data[key] == undefined)continue
				state.probjects[key] = data[key]
			}
		},
		createProbject(state){
			state.probjects = {
				name:'',
				id:'',
				type:'',
				httpType:'',
				styleName:'',//项目风格
				styleId:null,//项目风格
				style:'',
				sex:'Female',
				ageGroup:'Adult',//年龄组
				positionList:[],
				position:{},//衣服位置
				publishData:{
					id:'',
					portfolioDes:'',
					portfolioName:'',
					tagsDTO:[],
				},//发布的作品数据
				systemDesignerPercentage:30,
				model:{
					id:-1,
					url:'',
					type:'',
				},//模特
			}
		}
    },
    actions:{

    }
}

export default Workspace