import { getRatios } from '@/api/device'
import {
  getPrograms,
  deleteProgram
} from '@/api/program'
import { State } from '@/constant'
import Program from './Program'

export default {
  components: {
    Program
  },
  props: {
    status: {
      type: Number,
      default: State.READY
    }
  },
  data () {
    return {
      schema: {
        condition: {
          status: this.status,
          resolutionRatio: void 0,
          name: ''
        },
        list: getPrograms,
        filters: [
          { key: 'resolutionRatio', type: 'select', placeholder: '全部分辨率', simple: true, remote: getRatios },
          { key: 'name', type: 'search', placeholder: '节目名称' }
        ]
      }
    }
  },
  methods: {
    onDel (item) {
      deleteProgram(item).then(() => {
        this.$refs.table.decrease(1)
      })
    }
  }
}
