import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common';
import { Apis } from '@/gen/Apis';
import {
  HouseOccupantsCardTypeEnum,
  HouseOccupantsHouseRelationEnum,
  HouseOccupantsRelationWithOwnerEnum,
  HouseOccupantsStatusEnum,
} from '@/gen/Enums';
import { ProTable } from '@ant-design/pro-components';

export default function Index(props: MyBetaModalFormProps) {
  return (
    <ProTable
      {...MyProTableProps.props}
      // search={false}
      options={false}
      request={async (params, sort) =>
        MyProTableProps.request(
          { ...params, asset_houses_id: props.item?.asset_house?.id },
          sort,
          Apis.Archive.HouseOccupants.List,
        )
      }
      columns={[
        MyColumns.ID(),
        {
          title: '姓名',
          dataIndex: 'name',
        },
        {
          title: '手机号',
          dataIndex: 'phone',
        },
        MyColumns.EnumTag({
          title: '状态',
          dataIndex: 'status',
          valueEnum: HouseOccupantsStatusEnum,
          search: false,
        }),
        MyColumns.EnumTag({
          title: '与产权人关系',
          dataIndex: 'relation_with_owner',
          valueEnum: HouseOccupantsRelationWithOwnerEnum,
          search: false,
        }),
        MyColumns.EnumTag({
          title: '房客关系',
          dataIndex: 'house_relation',
          valueEnum: HouseOccupantsHouseRelationEnum,
          search: false,
        }),
        MyColumns.EnumTag({
          title: '证件类型',
          dataIndex: 'card_type',
          valueEnum: HouseOccupantsCardTypeEnum,
          search: false,
        }),
        MyColumns?.Image({
          title: '身份证正面',
          dataIndex: 'card_front_image',
        }),
        MyColumns?.Image({
          title: '身份证正面',
          dataIndex: 'card_back_image',
        }),
        MyColumns.CreatedAt(),
      ]}
    />
  );
}
