import { atom } from 'recoil'

export const textState = atom({
  key: 'textState',
  default: 'test text',
})

export const fontSizeState = atom({
  key: 'fontSizeState',
  default: 16,
})

export const canvasSizeState = atom({
  key: 'canvasSize',
  default: {
    vertical: 1500,
    horizontal: 1500,
  },
})

export const sortedPolygonArray = atom({
  key: 'sortedArray',
  default: [],
  dangerouslyAllowMutability: true,
})

export const roofState = atom({
  key: 'roof',
  default: {},
  dangerouslyAllowMutability: true,
})

export const wallState = atom({
  key: 'wall',
  default: {},
  dangerouslyAllowMutability: true,
})

export const roofPolygonPatternArrayState = atom({
  key: 'roofPolygonPattern',
  default: {}, //object ex) big, mid, sht = {point : [{x1, y1}, {x2, y1}], direction : left or right or top or bottom}
  dangerouslyAllowMutability: true,
})

export const roofPolygonArrayState = atom({
  key: 'roofPolygonArray',
  default: [],
  dangerouslyAllowMutability: true,
})

export const templateTypeState = atom({
  key: 'templateType',
  default: 1, //1:모임지붕, 2:A타입, 3:B타입
  dangerouslyAllowMutability: true,
})

//셀 그린 이후에 생성하는 state
export const drewRoofCellsState = atom({
  key: 'drewRoofCells',
  default: [],
  dangerouslyAllowMutability: true,
})

// 지붕재 width, height, rafter(서까래), roofStyle을 갖고있고 roofStyle 1은 정방향, 2는 지그재그
export const roofMaterialState = atom({
  key: 'roofMaterial',
  default: { width: 20, height: 10, rafter: 0, roofStyle: 2 },
  dangerouslyAllowMutability: true,
})
