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

export default function Index(props: MyBetaModalFormProps) {
  console.log(props?.item, 'pppppppp');
  return (
    <>
      <ProTable
        {...MyProTableProps.props}
        request={async (params, sort) =>
          MyProTableProps.request(
            { ...params, phone: props?.item?.phone },
            sort,
            Apis.Archive.HouseOccupants.CustomerHouseByPhone,
          )
        }
        search={false}
        options={false}
        columns={[
          {
            title: '关联房屋',
            dataIndex: ['asset_house', 'full_name'],

            search: false,
          },
          MyColumns.EnumTag({
            title: '状态',
            dataIndex: 'status',
            valueEnum: HouseOccupantsStatusEnum,
          }),
          MyColumns.EnumTag({
            title: '房客关系',
            dataIndex: 'house_relation',
            valueEnum: HouseOccupantsHouseRelationEnum,
            search: false,
          }),
          MyColumns.EnumTag({
            title: '与产权人关系',
            dataIndex: 'relation_with_owner',
            valueEnum: HouseOccupantsRelationWithOwnerEnum,
            search: false,
          }),
          {
            title: '入住日期',
            dataIndex: 'is_live_in',
            render(_, record) {
              return `${record?.move_in_date || '未入住'}`;
            },
            search: false,
          },
          {
            title: '退房日期',
            dataIndex: 'move_out_date',
            render(_, record) {
              return `${record?.move_out_date || '-'}`;
            },
            search: false,
          },

          // MyColumns.Option({
          //   render: (_, item: any, index, action) => (
          //     <Space key={index}>
          //       {/* 只有未生成账单的抄表记录,且不是重置读数，才显示修正按钮 */}
          //       {!item?.bill_status &&
          //         item?.operation_type !==
          //           HouseMeterReadingsOperationTypeEnum.ResetReading.value && (
          //           <CorrectReading item={item} reload={action?.reload} />
          //         )}
          //     </Space>
          //   ),
          // }),
        ]}
      />
    </>
  );
}
