import { ApiProperty } from '@nestjs/swagger' import { Type } from 'class-transformer' import { IsArray, IsEnum, IsObject, IsOptional, IsString, ValidateNested, } from 'class-validator' import { TaxSendStatus } from '../../dto/tax-switch.dto' export class NamaTaxBodyItemDto { @ApiProperty() @IsString() sstid: string @ApiProperty() @IsString() vra: string // @ApiProperty() // @IsString() // sstt: string @ApiProperty() @IsString() fee: string @ApiProperty() @IsString() dis: string @ApiProperty() @IsString() mu: string @ApiProperty() @IsString() am: string @ApiProperty() @IsString() consfee: string @ApiProperty() @IsString() bros: string @ApiProperty() @IsString() spro: string } export class NamaTaxHeaderDto { @ApiProperty({ required: true }) @IsString() ins: string @ApiProperty() @IsString() inp: string @ApiProperty({ required: true }) @IsString() inty: string // @ApiProperty({required: true}) // @IsString() // unique_tax_code: string @ApiProperty({ required: true }) @IsString() inno: string @ApiProperty({ required: true }) @IsString() tins: string @ApiProperty({ required: true }) @IsString() indatim: string @ApiProperty({ required: true }) @IsString() name: string @ApiProperty({ required: true }) @IsString() tob: string @ApiProperty() @IsOptional() @IsString() address?: string @ApiProperty() @IsOptional() @IsString() mobile?: string @ApiProperty() @IsString() bid: string } export class NamaTaxRequestDto { @ApiProperty({ type: [NamaTaxBodyItemDto] }) @IsArray() @ValidateNested({ each: true }) @Type(() => NamaTaxBodyItemDto) body: NamaTaxBodyItemDto[] @ApiProperty({ type: [Object] }) @IsArray() payment: unknown[] @ApiProperty({ type: NamaTaxHeaderDto }) @ValidateNested() @Type(() => NamaTaxHeaderDto) header: NamaTaxHeaderDto @ApiProperty() @IsString() uuid: string @ApiProperty() @IsString() economic_code: string @ApiProperty() @IsString() fiscal_id: string } export class NamaTaxSendItemResponseDto { @ApiProperty() @IsString() invoice_item_id: string @ApiProperty({ enum: TaxSendStatus }) @IsEnum(TaxSendStatus) status: TaxSendStatus @ApiProperty({ required: false, nullable: true }) @IsOptional() @IsString() tax_id?: string | null @ApiProperty({ required: false, nullable: true, type: Object }) @IsOptional() @IsObject() request_payload?: unknown @ApiProperty({ required: false, nullable: true, type: Object }) @IsOptional() @IsObject() response_payload?: unknown @ApiProperty({ required: false, nullable: true }) @IsOptional() @IsString() error_message?: string | null @ApiProperty({ required: false, nullable: true }) @IsOptional() @IsString() sent_at?: string | null @ApiProperty({ required: false, nullable: true }) @IsOptional() @IsString() received_at?: string | null } export class NamaTaxGetResponseDto { @ApiProperty() @IsString() tax_id: string @ApiProperty({ enum: TaxSendStatus }) @IsEnum(TaxSendStatus) status: TaxSendStatus @ApiProperty({ required: false, nullable: true, type: Object }) @IsOptional() @IsObject() response_payload?: unknown @ApiProperty({ required: false, nullable: true }) @IsOptional() @IsString() received_at?: string | null }